Rachel
Rachel

Reputation: 3

Flash actionscript 3.0 help (Buttons)

I'm a flash beginner, and I would like to create a button that will play a few frames following the frame it's on (a fade out), and then travel to a different part of the timeline. Is there an easy way to accomplish this? Or would it be easier to program a fade with actionscript instead of with an alpha effect?

Thanks in advance to anyone who can help.

Upvotes: 0

Views: 112

Answers (1)

Marty
Marty

Reputation: 39466

It sounds like you have a frame with a few buttons on it and you want to have each button click through to playing a different frame but for all of those buttons to first perform some kind of fade out animation.

You can achieve this by storing a reference to the frame you want to go to after the fade out is complete. Something like:

var destinationFrame:int = 0;

And then when you click a button:

button1.addEventListener(MouseEvent.CLICK, clickButton);

function clickButton(event:MouseEvent):void {
    destinationFrame = 40;
    gotoAndPlay(<frame for fade out transition>);
}

Finally, at the end of the fade out transition:

gotoAndPlay(destinationFrame);

Simply allocate the relevant destinationFrame based on the button you click.

Upvotes: 1

Related Questions