views:

14

answers:

1

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?

A: 

Maybe the addedToStage event (of the DisplayObject class) is what you're looking for.

M.A. Hanin
I already tried this but didn't work, tried to show that in the example above.
Tim