Search code examples
actionscript-3stage3d

can not set flash.geom.Matrix3D rawData


consider the following code:

var t:Matrix3D = new Matrix3D(
    new Vector.<Number>([1,0,0,0,0,1,0,0,0,0,1,0,10,10,0,1])
);

trace(t.rawData[12]);

the trace command will print "0" for me, and it is visible with debugger that rawData contains an identity matrix actually. I simply can not set the values contained by Matrix3D!

I'm using flash 11.2.

Thanks, for any help!


Solution

  • Pretty sure your syntax for creating a pre-filled Vector is wrong.

    You should have:

    new <Number>[values]
    

    Instead of:

    new Vector.<Number>([values])
    

    Demo:

    var wrong:Vector.<int> = new Vector.<int>([1,2,3]);
    var right:Vector.<int> = new <int>[1,2,3];
    
    trace(right[1]); // 2
    trace(wrong[1]); // error