Home Tutorials Forums Articles Blogs Movies Library Employment Press

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

 10-31-2011, 05:47 AM #1 lexxvlad Registered User   Join Date: Oct 2011 Posts: 1 Transformation matrix reset I use transform.matrix. I create dynamically several objects. Than place them on scene (X Y) and apply transformatiom matrix to them, to rotate and scale object via it`s central point. Code: for (var i:Number=1; i<6; i++) { OOK_Matrix[i] = OOK_Movie[i].transform.matrix; var pGlobal:Point = OOK_Movie[i].localToGlobal(new Point(OOK_Movie[i].width/2, OOK_Movie[i].height/2)); OOK_Points[i] = OOK_Movie[i].parent.globalToLocal(pGlobal); //trace(Angle); } All works grate. But I have follow problem: I need to change object position on screen. I set new X and Y. Objects moved to new place. All ok. But next operations with rotate and scale works some strange, not around it`s central point. For example rotation I do by next code: Code: rotateMatrixMethodsOnly(OOK_Movie[i],Angle,OOK_Matrix[i], OOK_Points[i]); function rotateMatrixMethodsOnly( obj:DisplayObject, angle:Number, mmtr:Matrix, pRotate_:Point ):void { var rad:Number = angle * (Math.PI / 180); mmtr.translate( -pRotate_.tx, -pRotate_.ty ); mmtr.rotate( rad ); mmtr.translate( pRotate_.tx, pRotate_.ty ); obj.transform.matrix = mmtr; }
 10-31-2011, 08:47 AM #2 OmerHassan Senior Member   Join Date: Mar 2009 Location: Islamabad, Pakistan Posts: 207 All transformations are applied relative to the registration point. If your display object's registration point is at its top-left corner then that's the point about which it will rotate. You can either set the registration point to your object's center by moving its contents along x by width/2 and along y by height/2, or you can rotate it about its current registration point and then translate it back to its original position.

 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 01:51 PM.

///