Skip to main content
Participating Frequently
April 28, 2010
Question

gotoAndPlay() doesn't go past a certain frame.

  • April 28, 2010
  • 7 replies
  • 2019 views

gotoAndPlay() is the only actionscript I have in my flash and all I want it to do is go to a frame. If I tell it to go to a frame past a certain one it will not. It always (unless I pick a frame previous to the messed up one) goes to that frame. I have only one scene.

This topic has been closed for replies.

7 replies

brooksrv
Participating Frequently
May 3, 2010

Based on what I see in the project file, I do see any interaction items, meaning as soon as the file started to play, it would immediately go to frame 1500 and you would not see frame 2. It is best practice to use a semi-colon after each function. I have also found it works best form my type of work to name the key frames that I want to use a gotoAndPlay command. Something I use is

btn_01.addEventListener(MouseEvent.CLICK, mClick01);

function mClick01(event:MouseEvent):void {
gotoAndPlay("S1");
}

Participant
April 30, 2010

If the swf is not fully loaded, then the frame sometimes doesn't "exist" yet. So if you have a loader then you would know that the entire swf is loaded, and should be able to proceed to any frame.

That could be one cause.

if you put this on the first frame it might help.

this.loaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);

function onLoadComplete(event:Event):void {

    trace("loading complete!"); //trace load completed

     gotoAndPlay("here")

}

brooksrv
Participating Frequently
April 29, 2010

Can you post your file?

IsimbotAuthor
Participating Frequently
April 29, 2010

Sure, I've made some changes and now the only actionscript is gotoAndPlay(1000) .

http://rapidshare.com/files/381715669/Project_File.fla.html

IsimbotAuthor
Participating Frequently
April 30, 2010

I may have figured it out, does cs4 load layers from bottom to top? My actionscript is in the top layer... Is there a way I can the loading of layer orders?

IsimbotAuthor
Participating Frequently
April 28, 2010

gotoAndPlay("Map")

That is the only actionscript in my entire .fla file. It starts at the same frame every time if I choose one past said same frame.

Also, if I add say gotoAndPlay("camprise") after that. It goes on to that frame label correctly. It's like something about that certain frame is broken. I have tried deleting the AS layer and redoing it but that did not help... It is always that frame.

On top of that, the gotoAndPlay function just seems to be off by a few frames on everything. I'm sorry if I'm being a bother, I'm pretty new to flash.

Participating Frequently
April 28, 2010

If you have stop() in that keyframe it will not play you have to tell to play the frame right after that particular keyframe or give your keyframe a label name and tell it to gotoAndPlay("yourLabel") and it will.

Participating Frequently
April 28, 2010

Ned Murphy
Legend
April 28, 2010

Describe your scene and show the code that doesn't seem to be working.