Home Tutorials Forums Articles Blogs Movies Library Employment Press

 ActionScript.org Forums Matrix
 Register FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

 10-16-2005, 06:20 PM #1 Xeef Off-Line     Join Date: Aug 2004 Location: Ibiza/Spain language :Hungarian/German/ abit English Posts: 6,539 Matrix 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 : Code: ```_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;``` __________________ test your self -->http://www.actionscript.org/forums/s...86&postcount=8
 10-16-2005, 06:40 PM #2 senocular six eyes     Join Date: Jan 2003 Location: San Francisco, CA (USA) Posts: 7,875 so what do you want to happen? You do not want it to scale in the coordinate space of the master? In the example, its not. Im confused as to what you're after __________________ (6)
 10-16-2005, 07:03 PM #3 Xeef Off-Line     Join Date: Aug 2004 Location: Ibiza/Spain language :Hungarian/German/ abit English Posts: 6,539 i wana Scale the Slave what's inside the Master in the Coordinate space of _root the 1. part of the code whit the Master.Slave the scale is done in the Master Space BUT it shoud by done in the _root Space as the result of the 2. part looks (where BOTH are on _root this is just to demonstrate what result i wana get) __________________ test your self -->http://www.actionscript.org/forums/s...86&postcount=8
 10-16-2005, 11:31 PM #4 Xeef Off-Line     Join Date: Aug 2004 Location: Ibiza/Spain language :Hungarian/German/ abit English Posts: 6,539 Hmmmm this Matrix stoff is a realy hard stoff ! Code: ```var cRad = Math.PI/180; // _root.createEmptyMovieClip("Master", 0); Master.Matrix = new flash.geom.Transform(Master); Master._bmp = new flash.display.BitmapData(150, 150, false, 0x00FF0000); Master.attachBitmap(Master._bmp, 0); Master.createEmptyMovieClip("Slave", 1); Master.Slave.Matrix = new flash.geom.Transform(Master.Slave); Master.Slave._bmp = new flash.display.BitmapData(50, 50, false, 0x000000FF); Master.Slave.attachBitmap(Master.Slave._bmp, 1); // TempMatrix = new flash.geom.Matrix(); TempMatrix.rotate(45*cRad); TempMatrix.translate(100, 50); Master.Matrix.matrix = TempMatrix; // TempMatrix = new flash.geom.Matrix(); TempMatrix.scale(1, 2); TempMatrix.rotate(-45*cRad); TempMatrix.translate(80, 60); Master.Slave.Matrix.matrix = TempMatrix; // // // // // // // Matrix_Apply = new flash.geom.Matrix(); Matrix_Apply.scale(1.5, 1); Master.Slave.Matrix.matrix = MatrixWrap(Master.Matrix.matrix, Master.Slave.Matrix.matrix, Matrix_Apply); // function MatrixWrap(Matrix_Parent, Matrix_Self, Matrix_Apply) { var Matrix_Parent = Matrix_Parent.clone(); var Matrix_Self = Matrix_Self.clone(); var Matrix_Apply = Matrix_Apply.clone(); var Matrix_Return = new flash.geom.Matrix(); // var X = Matrix_Self.tx; Matrix_Self.tx = Matrix_Parent.tx =0; var Y = Matrix_Self.ty; Matrix_Self.ty = Matrix_Parent.ty = 0; // Matrix_Return.concat(Matrix_Self); Matrix_Return.concat(Matrix_Parent); Matrix_Return.concat(Matrix_Apply); Matrix_Parent.invert(); Matrix_Parent.tx += X; Matrix_Parent.ty += Y; Matrix_Return.concat(Matrix_Parent); return Matrix_Return; }``` seams to work __________________ test your self -->http://www.actionscript.org/forums/s...86&postcount=8

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home ActionScript Forums Group     ActionScript 3.0     ActionScript 2.0     ActionScript 1.0 (and below)     Simple Stuff (Newbies) Flash General Questions     Flash 10 General Questions     Flash 9 General Questions     Flash 8 General Questions     Other Flash General Questions Flex     Flex 2, 3 & 4     Flex 1 Extensions and Plugins     Components     JSFL - Extending Flash Desktop, Mobile and non-browser Environments     AIR (Apollo)     FlashLite / Portable Devices Development     Projectors and CDs Supporting Technologies     HTML and JavaScript     haXe     Server-Side Scripting     Flash Remoting     Flash Media Server General     Best Practices     Gaming and Game Development     Animation and Effects     Flashants Support Forum Community Boards     General Chat     Just for Kicks Challenges     Detention Flash In Action     Site Check     Cool Sites     Widgets Decommissioned     Projects and Positions CMS Forums     Announcements Board     Content Postings / Updates     Product Review Requests     CMS Technical Questions     Process Questions     Collaboration & Suggested Articles

All times are GMT. The time now is 06:45 AM.

///