Jump to content


Need help toggling my tween

Recommended Posts

There is a prob an easy solution to this. I'm having a hard time finding the logic that I need.

So I have a window that needs to open and close on the click of a button. so first click window opens. Second click window closes.


This is what i think my code will kind of look like but doesn't work.

I don't know how to structure the logic.

can someone help me out?


import flash.events.MouseEvent;

import com.greensock.*;
import com.greensock.easing.*;

container_mc.find_more_btn.addEventListener(MouseEvent.CLICK, myFunction);
function myFunction(event:MouseEvent):void

   if(event.type == "Click"){
   }else if(event.type == "Click++"){

Link to comment
Share on other sites

I've attached a basic example


here is the code:


import com.greensock.*;
import flash.events.MouseEvent;

window.alpha = 0;
var windowShowing:Boolean = false;
var windowTween:TweenLite = TweenLite.to(window,.5,{alpha:1,paused:true});

toggle_btn.addEventListener(MouseEvent.CLICK, toggleWindow);

function toggleWindow(e:MouseEvent):void
//this makes windowShowing the opposite of what it is, if true then switches to false
       //if false then switches to true
windowShowing = ! windowShowing;

if (windowShowing)
               //do something to show your window
               //do something to hide the window

Link to comment
Share on other sites

Thanks Carl


I'll give this a go in the morning and keep the code on hand for next time.

I appreciate the time you put in to show me this.


- John

Link to comment
Share on other sites

you're welcome. let me know if it works for you.



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.