Mega Code Archive

 
Categories / Flex / Components
 

Use Matrix3D to Apply Transformations Within a Layout

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:s="library://ns.adobe.com/flex/spark">     <mx:Script>                      import mx.core.UIComponent;             [Bindable] private var rot:Number = 45;             private function rotate():void             {                 var matrix:Matrix3D = button.getLayoutMatrix3D();                 matrix.appendRotation( 45, Vector3D.Z_AXIS );                 button.layoutMatrix3D = matrix;                 rot += 45;             }            </mx:Script>     <s:Group>         <s:Group width="120">             <mx:Button id="button" label="Rotate" click="rotate();" />             <s:Rect id="rect" rotationZ="{rot}" width="110" height="50">                 <s:fill>                     <mx:SolidColor color="#000000" />                 </s:fill>             </s:Rect>         </s:Group>         <s:Rect width="100%" height="100%">             <s:stroke>                 <mx:SolidColorStroke color="#000000" />             </s:stroke>         </s:Rect>     </s:Group> </mx:Application>