开发者

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

I开发者_如何学编程s there a simple way to get the frame number of a frame label?


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;
  }


Look at the frame property from the FrameLabel


currentFrame return the current frame number of the movieclip.

import flash.display.FrameLabel;

var frameNumber:int = -1;
frameNumber = MyMovieClip.currentFrame;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜