why aren't my 3d properties set on the stage in flash cs4 accessible

I have made a very simple swf in which I have a MovieClip which I have rotated on the stage. When I try to access this rotationX and rotationY properties of this clip using the constructor of the class assigned to this MovieClip they are coming back as 0 even though they shouldn't be. If I put an on rollover event of the MovieClip and trace out these properties here I get the correct values.

package {

    import flash.display.MovieClip;
    import flash.events.MouseEvent;

    public class TestMC extends MovieClip {

        function TestMC() {
            trace ("ROTATION IS "+this.rotationX+" "+this.rotationY); //traces ROTATION IS 0 0 
            addEventListener(Event.ADDED_TO_STAGE, init);
            addEventListener(MouseEvent.ROLL_OVER, rollOver);
        }
        function init(e:Event) {
            trace ("INIT ROTATION IS "+rotationX+" "+rotationY); //traces INIT ROTATION IS 0 0 
        }
        function rollOver(e:Event) {
            trace ("ROTATION IS "+rotationX+" "+rotationY); //traces correct values!
        }
    }
}

I also get the correct values when I read the values from the stage timeline.

trace ("TEST "+testMC.rotationX+" "+testMC.rotationY); //returns correct value

Is there a specific event I need to be waiting for which will tell me when the 3d properties are available via ActionScript?


也许addToStage事件(的DisplayObject类)是你正在寻找。

链接地址: http://www.djcxy.com/p/17734.html

上一篇: 加载swf到另一个swf

下一篇: 为什么我的3d属性不能在flash cs4中的舞台上设置