Solved

Create Flash Buttons that animate after being clicked?

Posted on 2003-11-27
3
597 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
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 how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now