Xeef
10-16-2005, 07:20 PM
have a couple of cascaded MC's each have diferent Matrixtransformations on them
let's say for now Master & Master.Slave
now i rotate the Master by 45º
so the Master & the Slave is rotated (this shoud by so)
now i wana Scale the Slave
and here coms the problem !
it's scales BUT in the coordinatesystem of the Master !
and tath shoud NOT by !!!
how can i calculate this ?????
see code for more :
_root.createEmptyMovieClip("Master", 0);
TM = new flash.geom.Transform(Master);
_bmp1 = new flash.display.BitmapData(150, 150, false, 0x00FF0000);
Master.attachBitmap(_bmp1, 0);
Master.createEmptyMovieClip("Slave", 1);
TS = new flash.geom.Transform(Master.Slave);
_bmp2 = new flash.display.BitmapData(50, 50, false, 0x000000FF);
Master.Slave.attachBitmap(_bmp2, 1);
//
M = new flash.geom.Matrix();
M.translate(100, 50);
TM.matrix = M;
//Rotate Master
M.identity();
M.rotate(45/180*Math.PI);
Tmp = TM.matrix.clone();
M.concat(Tmp);
TM.matrix = M;
//Scale Slave
M.identity();
M.scale(2, 1);
Tmp = TS.matrix.clone();
M.concat(Tmp);
TS.matrix = M;
////////////////////////////
//
//
//This is how it shoud look :
//
_root.createEmptyMovieClip("Master1", 1);
TM1 = new flash.geom.Transform(Master1);
_bmp1 = new flash.display.BitmapData(150, 150, false, 0x00FF0000);
Master1.attachBitmap(_bmp1, 0);
_root.createEmptyMovieClip("Slave1", 2);
TS1 = new flash.geom.Transform(Slave1);
_bmp2 = new flash.display.BitmapData(50, 50, false, 0x000000FF);
Slave1.attachBitmap(_bmp2, 1);
//
M = new flash.geom.Matrix();
M.translate(350, 50);
TM1.matrix = M;
TS1.matrix = M;
//
M.identity();
M.rotate(45/180*Math.PI);
Tmp = TM1.matrix.clone();
M.concat(Tmp);
TM1.matrix = M;
M.identity();
M.rotate(45/180*Math.PI);
Tmp = TS1.matrix.clone();
M.concat(Tmp);
TS1.matrix = M;
//
M.identity();
Orgmatrix = TS1.matrix.clone();
M.a = 2;
M.d = 1;
//
M.tx = Orgmatrix.tx;
M.ty = Orgmatrix.ty;
//
Orgmatrix.tx = 0;
Orgmatrix.ty = 0;
Orgmatrix.concat(M);
TS1.matrix = Orgmatrix;
let's say for now Master & Master.Slave
now i rotate the Master by 45º
so the Master & the Slave is rotated (this shoud by so)
now i wana Scale the Slave
and here coms the problem !
it's scales BUT in the coordinatesystem of the Master !
and tath shoud NOT by !!!
how can i calculate this ?????
see code for more :
_root.createEmptyMovieClip("Master", 0);
TM = new flash.geom.Transform(Master);
_bmp1 = new flash.display.BitmapData(150, 150, false, 0x00FF0000);
Master.attachBitmap(_bmp1, 0);
Master.createEmptyMovieClip("Slave", 1);
TS = new flash.geom.Transform(Master.Slave);
_bmp2 = new flash.display.BitmapData(50, 50, false, 0x000000FF);
Master.Slave.attachBitmap(_bmp2, 1);
//
M = new flash.geom.Matrix();
M.translate(100, 50);
TM.matrix = M;
//Rotate Master
M.identity();
M.rotate(45/180*Math.PI);
Tmp = TM.matrix.clone();
M.concat(Tmp);
TM.matrix = M;
//Scale Slave
M.identity();
M.scale(2, 1);
Tmp = TS.matrix.clone();
M.concat(Tmp);
TS.matrix = M;
////////////////////////////
//
//
//This is how it shoud look :
//
_root.createEmptyMovieClip("Master1", 1);
TM1 = new flash.geom.Transform(Master1);
_bmp1 = new flash.display.BitmapData(150, 150, false, 0x00FF0000);
Master1.attachBitmap(_bmp1, 0);
_root.createEmptyMovieClip("Slave1", 2);
TS1 = new flash.geom.Transform(Slave1);
_bmp2 = new flash.display.BitmapData(50, 50, false, 0x000000FF);
Slave1.attachBitmap(_bmp2, 1);
//
M = new flash.geom.Matrix();
M.translate(350, 50);
TM1.matrix = M;
TS1.matrix = M;
//
M.identity();
M.rotate(45/180*Math.PI);
Tmp = TM1.matrix.clone();
M.concat(Tmp);
TM1.matrix = M;
M.identity();
M.rotate(45/180*Math.PI);
Tmp = TS1.matrix.clone();
M.concat(Tmp);
TS1.matrix = M;
//
M.identity();
Orgmatrix = TS1.matrix.clone();
M.a = 2;
M.d = 1;
//
M.tx = Orgmatrix.tx;
M.ty = Orgmatrix.ty;
//
Orgmatrix.tx = 0;
Orgmatrix.ty = 0;
Orgmatrix.concat(M);
TS1.matrix = Orgmatrix;