开发者

Problems mixing AS2 and AS3

For the life of me I can't figure out how to trace out the current label in my movie's main timeline. This is in AS3.

I have a 开发者_开发技巧button on stage that spans the timeline of the movie. It detects keypresses. I want to trace the current frame label that the play head is on.

on(keypress "<left>") { 
 trace(this);
 trace(this.currentFrameLabel);
 trace(this.currentLabel);
 trace(currentFrameLabel);
 trace(currentLabel);
} 

I get "_level0" for this...and undefined for the rest. What am I doing wrong here?


Are you publishing an AS1/2 or an AS3 movie? on(keypress "left") is AS1 (not even 2), and currentFrameLabel and currentLabel are AS3 properties of the MovieClip class. You'll need to use event listeners in AS3:

addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandler);

And if you are publishing for AS2, currentFrameLabel and currentLabel will be undefined but AS1/2 has the MovieClip._currentframe property which is an integer.

AS2 and AS3 are compiled into different bytecode (AS1/2 gets compiled to AVM1 and AS3 to AVM2), so you cannot have them in the same compiled swf file.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜