Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

New to AS3, code snippet not working

Explorer ,
May 15, 2013 May 15, 2013

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);
}

TOPICS
ActionScript
941
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 15, 2013 May 15, 2013

Have you placed a stop() somewhere at or after frame 7 so that the timeline is not looping back to frame 1?

Translate
LEGEND ,
May 15, 2013 May 15, 2013

Have you placed a stop() somewhere at or after frame 7 so that the timeline is not looping back to frame 1?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 15, 2013 May 15, 2013

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 15, 2013 May 15, 2013
LATEST

You're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines