Copy link to clipboard
Copied
I just built a button with insert->new symbol... from the menu. For the "mouse over" frame, I converted it to a new symbol(movie clip), because I want to display many different pics on different frames when I have mouse over it. It does work. In addition, I want to make it stop at current frame when I click on it. Someone tell me I should write some codes and get the frame ID of the current frame, then stop on it. How to get the frame ID and stop at the frame I want?
If you put this code in the MovieClip you created. This will work, but it may not be what you envision. You'll want to create a new actions layer and make sure the code is in frame 1.
addEventListener(MouseEvent.MOUSE_OVER, stopOver);
function stopOver(event: MouseEvent): void {
stop();
}
addEventListener(MouseEvent.MOUSE_OUT, playOut);
function playOut(event: MouseEvent): void {
play();
}
This might be better, this way your view were will be able to move the mouse out of the way to completely see your
...Copy link to clipboard
Copied
You should only need to execute a stop(); command pointed at the timeline that you wish to have stop.
Copy link to clipboard
Copied
If you put this code in the MovieClip you created. This will work, but it may not be what you envision. You'll want to create a new actions layer and make sure the code is in frame 1.
addEventListener(MouseEvent.MOUSE_OVER, stopOver);
function stopOver(event: MouseEvent): void {
stop();
}
addEventListener(MouseEvent.MOUSE_OUT, playOut);
function playOut(event: MouseEvent): void {
play();
}
This might be better, this way your view were will be able to move the mouse out of the way to completely see your image, but it does involve a click. Again, put this inside the MovieClip you created:
addEventListener(MouseEvent.CLICK, clickEvent);
var t: Boolean; // true or false variable, starts off as false.
function clickEvent(event: MouseEvent): void {
if (!t) { // Looks to see if the 't' is faults, if it is, the movie stops.
stop();
} else { // Otherwise, it plays.
play();
}
t = !t; // This toggles the 't' variable to whatever it wasn't; false becomes true or vice versa.
}
If you're just experimenting, either option will work. Otherwise, you'll have to be more specific in your description in relationship to what you want to accomplish.
Good luck.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now