views:

11

answers:

1

Hello there,

Flash Tranformation Matrix via JsFL are mean to me :(

I have to write a JsFL script that creates a text on my Flash scene, and rotate it with a random angle. Imagine I want to create and rotate a "Hello World!" at 45 degrees, my code looks like that :



rotateAngle = 45;

//creates my new text at x:0, y:0 coordinates
fl.getDocumentDOM().addNewText({left:0, top:0, right:10, bottom:10});
fl.getDocumentDOM().setTextString('Hello World!');

var mat = fl.getDocumentDOM().selection[0].matrix; //get the current matrix

// set rotation
mat.a = Math.cos( rotateAngle );
mat.b = Math.sin( rotateAngle);
mat.c = - Math.sin(rotateAngle);
mat.d = Math.cos( rotateAngle );

fl.getDocumentDOM().selection[0].matrix = mat; //apply new matrix


the problem is : the rotation applied to my text is 58.3 instead of 45.

I have to admit that I'm kind of noob with matrix... so I used the "matrix transformation for rotation" here : http://www.senocular.com/flash/tutorials/transformmatrix/

Ideas ?

thank you.

A: 

Have you tried with radians instead of degrees?

Cesario
You're my super star (and I'm super ashamed of my mistake).Thanks a lot.
Rootosaurus
i'll always be there for you (this website is a private chat right? :D)
Cesario