开发者

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

开发者 https://www.devze.com 2023-02-08 02:38 出处:网络
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 conta

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

精彩评论

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