Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AS3: Simple way to get the frame number of a frame label

Is there a simple way to get the frame number of a frame label?

like image 428
redconservatory Avatar asked Jan 31 '11 01:01

redconservatory


2 Answers

i haven't tested it but the following should work. the labels property of the Scene object is an Array of objects containing both the label & number of the frames.

 private function getFrameByLabel( frameLabel: String ):int
 {
       var scene:Scene = yourMovieClip.currentScene;

       var frameNumber:int = -1;

       for( var i:int ; i < scene.labels.length ; ++i )
       {
            if( scene.labels[i].name == frameLabel )
                frameNumber = scene.labels[i].frame;
       }

       return frameNumber;
  }
like image 94
PatrickS Avatar answered Oct 20 '22 00:10

PatrickS


Look at the frame property from the FrameLabel

like image 25
Patrick Avatar answered Oct 20 '22 00:10

Patrick