Solved

Create Flash Buttons that animate after being clicked?

Posted on 2003-11-27
3
600 Views
Last Modified: 2010-05-18
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
0
Comment
Question by:dissonant
  • 2
3 Comments
 
LVL 9

Expert Comment

by:OBCT
ID: 9835078
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
0
 

Author Comment

by:dissonant
ID: 9841206
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
0
 
LVL 9

Accepted Solution

by:
OBCT earned 125 total points
ID: 9841670
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
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question