Share Posted July 14, 2011 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"){ TWEEN FORWARD }else if(event.type == "Click++"){ TWEEN BACK } Link to comment Share on other sites More sharing options...
Share Posted July 15, 2011 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 windowTween.play(); } else { //do something to hide the window windowTween.reverse(); } } Link to comment Share on other sites More sharing options...
Author Share Posted July 15, 2011 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 More sharing options...
Share Posted July 15, 2011 you're welcome. let me know if it works for you. carl Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now