Skip to main content
Participant
December 27, 2012
Answered

gotoAndPlay won't go to certain frame labels? All because of a harmless mc?

  • December 27, 2012
  • 1 reply
  • 15403 views

let's say I have a timeline with 5 keyframes, each labelled. Let's call them:

"one", "two", "three", "four", "five"

On all three I have a stop();

And on frame "one" I also command it to go to frame "two" with gotoAndPlay("two");

Test play, and it works.

Same works with gotoAndPlay("three") and "four", but when I try gotoAndPlay("five");

it somehow plays "four" instead. Stranger still is that when I switch the order of the keyframes to "one", "two", "three", "five", "four", it plays frame "five" just fine.

I isolated the problem thinking it was a stray code, but it wasn't.

It was a movieclip with no code, no linkage whatsoever. If it was there, the error was there. If I delete it, the error is gone.

What is this? I've never encountered such a problem.

Using Flash CS6.

This topic has been closed for replies.
Correct answer kglad

Hm that would seem logical, the fact that it's trying to go to a frame that's not yet loaded.

Everything goes screwy when I try to load something past frame 50 (Note than within this 50 frames are actually lots of frames. Instead of a timeline filled with tweens and animations, I contain each scene in a movie clip.

Yes I am doing it when it first starts.

No, no preloaders.

So what's the solution here? Use a preloader?

I'm no coder so I don't know to make a prealoder, but would a 'title screen' of some sort help? A play button on the first frame so that it loads in the background first before I press the button to play the animation?


on frame 1 use:

stop();

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

function gotoF(e:Event):void{

gotoAndPlay("five");

}

// if that works, please mark helpful/correct responses

// if that fails, upload your fla to a file server and post a link.

1 reply

Participant
December 27, 2012

UPDATE things got ever weirder.

This mysterious 'harmless' movieclip was actually one of four inside another movieclip.

Let's call them: A, B, C and D.

At first I came to the conclusion that A was the problem, since the problem would disappear when I deleted A and not when I deleted B, C, D.

In a strange twist, if I kept deleting and undoing, A would no longer be the problem. Now, B had to be deleted for the issue to go away. Then C, then D.

This is weird.

sinious
Legend
December 27, 2012

Try changing your frame labels to (FL = Frame Label) "FLOne", "FLTwo", "FLThree", "FLFour", "FLFive". Use those names to gotoAndPlay(). See if you get issues.

Remember that many class names are auto-generated under the hood in Flash. Using something so generic as "one" can get you into trouble. If renaming the labels fixes it, the order in which you're adding clips seems like the culprit as something is colliding under the hood. Making the labels unique intentionally might solve it.