Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Create Flash Buttons that animate after being clicked?

Posted on 2003-11-27
3
602 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Stop Ads in Browser Google Chrome 3 546
High Internet Explorer CPU on Flash site in Citrix 2 838
black magic design 1 130
Some You tube not working in IE11 on Windows 10 and 8.1 5 80
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
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 how to record live broadcast.
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.

789 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