Create Flash Buttons that animate after being clicked?

Hi

I assume that this question has a simple answer, but days of searching the net hasn't helped me. I'm relatively new to Flash - or at least this aspect of the program.

Okay, what I want is a button that continues to animate (once only) AFTER it has been clicked. Right now I have to keep the mouse pressed down for the animation to play, because I put the movie clip in the down state.

Because it's a website the buttons are the same on every page and I want the animation to finish even if the next scene has loaded already. I want the animation to play once only.

I've seen many Flash sites that animate while the next page/scene loads. How do I do this?


Thanks in advance to any helpful people.
-dissonant
dissonantAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

OBCTCommented:
dissonant ,

My suggestion is, that you should make your button a movie clip then give it the instance name of "button1" or anything you want. Make 3 keyframes in that movie clip. The first one for what you want the button to look like, on the second frame make it look like what ever you want for the "over", then on the third make the "down" button.
On each of those 3 keyframes add this code:      stop();
Make another keyframe in that movie clip on frame 4. Here you can add your animation but if you only want it to play once, then make sure its a motion tween and add "stop();" to the first and last keyframe for the tween.
Now go back to your main scene, click the movie clip and add this code:

on (rollOver) {
     _root.button1.gotoAndStop(2);
}
on (press) {
     _root.button1.gotoAndStop(3);
}
on (release) {
     _root.button1.gotoAndPlay(5);
}

What this code does is tell flash where to go when certain actions are performed.
The _root.button1  means "_root." is the main movie and "button1" is the instance name of your movie clip.
The gotoAndStop(2); tells flash to goto frame 2 and stop.
_root.button1.gotoAndPlay(5); tells flash to go to the frame after the stop() action and play it. Because you have a stop() action at the end of the motion tween, it will only play once.
If you want me to give you the source code, just let me know.

Cheers

-OBCT
dissonantAuthor Commented:
Yeah, could I get the source off you? I tried it and the button doesn't react at all. The animation is keyframe, not tween, could that be the problem?

dale@australiamail.com
OBCTCommented:
http://www.wren-intermedia.com/ee/button_mc.fla

Take a look at that and then try using the same actions in your fla

Cheers

-OBCT

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.