Skip to main content
Participating Frequently
October 9, 2012
Question

Goto previous frame or next frame not working

  • October 9, 2012
  • 1 reply
  • 3933 views

I'm using flash professional to build mobile application.

I have goto and stop frames on frame 1 and they work fine.  When I go to frame next frame and try to add go to previous frame from a button it doesn't work.  I don't get errors or anything it just doesn't work.

Someone please help.

This topic has been closed for replies.

1 reply

Mark.fromOP
Inspiring
October 9, 2012

Can you post some code. Is your movie clip multiple frames? If you have gotoAndStop(2) on frame 1 then the movie clip jumps to frame 2 then when you do prevFrame from 2 it auto fires the gotoAndStop(2) function that you have on frame 1 so it looks like you are stuck on 2 when in reality it did execute the function to go to 1 but then automaticallly was advanced back to 2.

Participating Frequently
October 9, 2012

yes I have multiple frames.  Frame 1 is 1-10, frame 2 is 2-10 etc.....

This could easily have 50 frames or so because the app has tons of pages.  Here is the code:

/* 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 Stop

Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.

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.

*/

w1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame);

function fl_ClickToGoToAndStopAtFrame(event:MouseEvent):void

{

    gotoAndStop(12);

}

/* Click to Go to Frame and Stop

Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.

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.

*/

traffic.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_2);

function fl_ClickToGoToAndStopAtFrame_2(event:MouseEvent):void

{

    gotoAndStop(92);

}

beauty.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_4);

function fl_ClickToGoToAndStopAtFrame_4(event:MouseEvent):void

{

    gotoAndStop(25);

}/* Click to Go to Frame and Stop

Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.

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.

*/

video.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_5);

function fl_ClickToGoToAndStopAtFrame_5(event:MouseEvent):void

{

    gotoAndStop(35);

}/* Click to Go to Frame and Stop

Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.

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.

*/

news.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_6);

function fl_ClickToGoToAndStopAtFrame_6(event:MouseEvent):void

{

    gotoAndStop(55);

}/* Click to Go to Frame and Stop

Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.

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.

*/

grant.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_7);

function fl_ClickToGoToAndStopAtFrame_7(event:MouseEvent):void

{

    gotoAndStop(75);

}/* Click to Go to Frame and Stop

Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.

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.

*/

p1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_8);

function fl_ClickToGoToAndStopAtFrame_8(event:MouseEvent):void

{

    gotoAndStop(85);

}/* 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.

*/

gossip.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_11);

function fl_ClickToGoToAndStopAtFrame_11(event:MouseEvent):void

{

    gotoAndStop(11);

}

Here is the code to the next frame but it won't do anything:

bk_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToPreviousFrame);

function fl_ClickToGoToPreviousFrame(event:MouseEvent):void

{

    prevFrame();

}

Once I get out of the the first page or frame I notice when I hover over the button it notices that it's a button but it won't click to go to next or previous frame.  None of the button actions work once I get out of the first page.

Mark.fromOP
Inspiring
October 9, 2012

Hmm, here is what might be up. On frame 1 you have your symbols on the stage and they are labeled, gossip, p1, grant... but maybe as you hop around the different frames your symbols on the stage loose their identifiers and therefore flash knows not what to assign those listeneres too. Make sure all your symbols have proper lables on all the frames. Best way to do this is to keep symbols that will be present through out the app on a separate layer and have that layer stretch beginning to end instead of having a key frame for each frame of the app. And you might also only have the actions layer on the first frame so on all other frames there is no code whatsoever and everything just comes to a hault.

Also your code is so messy, delete the code snippet instructions it will make it much easier to navigate around.