Copy link to clipboard
Copied
import flash.events.MouseEvent;
stop(); //pause the timeline
addEventListener(MouseEvent.CLICK, Go);
function Go(e: MouseEvent) {
gotoAndPlay("Frame1");
}
So this function plays an animation of a trap door opening.
In another symbol, I have the ball that falls out of the trap door and moves around the screen. What Action script do I have to put in the other symbol to make it start playing when function Go starts to play?
Hi James
What ClayUUID is saying is that you have to extend your Go-function as below. First let's assume your ball-symbol is a movieclip. Give it an instance name in the properties panel. Call it simply "ball".
Now within ball in the timeline add a layer and call it "actions". Here in the first frame code:
stop();
If you want the ball to stop again after the falling-out-of-the-trapdoor animation has finished, then add a stop(); in the last frame too.
I also assume that you have a button which start
...Copy link to clipboard
Copied
You don't. You make the Go function tell both of them to start playing.
Copy link to clipboard
Copied
Hi James
What ClayUUID is saying is that you have to extend your Go-function as below. First let's assume your ball-symbol is a movieclip. Give it an instance name in the properties panel. Call it simply "ball".
Now within ball in the timeline add a layer and call it "actions". Here in the first frame code:
stop();
If you want the ball to stop again after the falling-out-of-the-trapdoor animation has finished, then add a stop(); in the last frame too.
I also assume that you have a button which starts the whole process (going to Frame1 and making the ball play. Let's call this button for this example "gobtn".
Then in the frame/actionscript where you have the Go-function, extend it like this:
import flash.events.MouseEvent;
stop(); //pause the timeline
gobtn.addEventListener(MouseEvent.CLICK, Go);
function Go(e: MouseEvent) {
ball.play();
gotoAndPlay("Frame1");
}
You have to make sure that in the frame where the Go-function is, the ball is also present. See that in the first ball-stop()-frame any visual content itself is not present or invisible.
That should do the trick
Klaus