Skip to main content
Known Participant
April 13, 2013
Answered

How to get the frame number of a label in a different scene.

  • April 13, 2013
  • 1 reply
  • 1135 views

I am completely stumped on this.

I have my project setup as the gameplay in one scene, and another scene for the outcome.

The outcome scene, say called, GameDone, has 2 frames. The first frame for win, labeled it WON, the second frame for lost, labeled LOST.

I could do the very simple thing and just gotoAndStop("GameDone", 1); but thats a bad practice, I believe.

Ive gone through google and found the closest thing needing a MovieClip. I could not figure out what to give it? A random MovieClip? a new one? one from the next scene? one from the current scene?

import flash.display.Scene;  

for (var i:uint = 0; i < mc1.scenes.length; i++) {
     var scene:Scene = mc1.scenes;
     trace("scene " + scene.name + ": " + scene.numFrames + " frames");
}

That was an adobe sample.

So how could I, in the gameplay scene, the frame number for either WON or LOST in the "GameDone" scene?

Thanks.

This topic has been closed for replies.
Correct answer Ned Murphy

Try doing the simple thing that you think is a bad practice.  I don't know why you think it is.  The only problem with it is that you appear to have it backwards for AS3... in AS3 it is gotoAndStop(frame,scene);

Why don't you use the frame labels instead of frame numbers?  gotoAndStop("Won", "GameDone");

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
April 13, 2013

Try doing the simple thing that you think is a bad practice.  I don't know why you think it is.  The only problem with it is that you appear to have it backwards for AS3... in AS3 it is gotoAndStop(frame,scene);

Why don't you use the frame labels instead of frame numbers?  gotoAndStop("Won", "GameDone");

Known Participant
April 13, 2013

EDIT:

My bad, you had it right, I actually messed up the cases, I was trying WON when it was Won, same with LOST.

Thanks.

Ned Murphy
Legend
April 13, 2013

You're welcome