Copy link to clipboard
Copied
Hello. I'm new to AS3. I'm trying to move onto AS3 from AS2 so that I can make a video gallery app.
I've been using the code snippets in Flash, and the buttons work in a way, but it keeps playing the same movie over and over again, which is the first movie. Can anyone help me? I want people to click on a button and have it play a different video associated with that video. In reality, though, clicking on that button just takes the user to a different frame that has that video on it. Here's the script:
/* Stop at This Frame
The Flash timeline will stop/pause at the frame where you insert this code.
Can also be used to stop/pause the timeline of movieclips.
*/
stop();
/* Click to Go to Frame and Play
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and continues playback from that frame.
Can be used on the main timeline or on movie clip timelines.
Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
*/
PipeStr_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame);
function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):void
{
gotoAndPlay(1);
}
/* Click to Go to Frame and Play
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and continues playback from that frame.
Can be used on the main timeline or on movie clip timelines.
Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
*/
SealInts_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_2);
function fl_ClickToGoToAndPlayFromFrame_2(event:MouseEvent):void
{
gotoAndPlay(7);
}
Have you placed a stop() somewhere at or after frame 7 so that the timeline is not looping back to frame 1?
Copy link to clipboard
Copied
Have you placed a stop() somewhere at or after frame 7 so that the timeline is not looping back to frame 1?
Copy link to clipboard
Copied
Thank you so much!!! I went ahead and just changed the 'gotoandPlay' to 'gotoandStop'. That fixed it! I hadn't even noticed that there was no stop in there. Thanks!
Copy link to clipboard
Copied
You're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now