Copy link to clipboard
Copied
I have a section in the timeline based website I'm making with Ationscript 3 in Flash CS5. I want a square with some content in it to slide into frame when a button it pushed but if another button is pushed I want it to slide back out of frame before the content corresponding with the other button enters. I've seen this done before but I can't remember how. I think it had something to do with setting up a specific variable but that's about it and it's pretty vague. haha.
Can anybody help with that or even just point be towards a tutorial or something because I think this is done fairly frequently.
Thanks.
Copy link to clipboard
Copied
it's easiest to do that sort of thing using actionscript. it can be done with the timeline, but it's easier if you use actionscript to tween
can you use actionscript to tween objects (using the Tween class or a 3rd party tweening class like TweenLite)?
Copy link to clipboard
Copied
My background is in animation so I usually prefer to work visually if I can as appose to using script, so I no I can't use actionscript to tween objects, lol. I'm not apposed to learning though.
Copy link to clipboard
Copied
if you're going to use the timeline for that you're pretty much limited to using gotoAndPlay in your button listeners:
btn.addEventListener(MouseEvent.CLICK,btnClickF);
function btnClickF(e:MouseEvent):void{
gotoAndPlay("some frame label");
}
Copy link to clipboard
Copied
Okay...I think I can handle that...here's something that migth be easier. I wanna do a similar thing but instead of the object sliding in and out of frame it want it to fade on and off. I do use the fade in/fade out a movie clip feature from the code snippets fairly often. But I'm having trouble having it fade out before going to another point on the timeline. I feel like this should just be an additional line of code to function properly am I right? And if so what would that line of code be?
Copy link to clipboard
Copied
yes, you could use the same line (Tween class) line of code you used to fade your object in. just change the start and end tween parameters.
Copy link to clipboard
Copied
Okay I'm not sure if that will achieve what I mean or not...I started doing it and then I realized I maybe wasn't following you. To clarify though in case I just presented my question wrong. I know how the 'fade out a movieclip' code snippet works on it's own. If I apply it to a movie clip at a certain point on the timeline the movieclip will fade away. The problem is if the user clicks a button to navigate away from the movieclip I want it to fade away and I can't simply have that fade command on a specific point on the timeline because there's no way of knowing what button the user will click on and thusly what part of the timeline they will then find themselves on. Is that possible?
Copy link to clipboard
Copied
put the tween in your button listener function. ie, your button click calls a function and inside that function is the tween.