The following example shows how you can rotate a Flex Image control along its x-axis, y-axis, and z-axis using the new rotationX, rotationY, and rotationZ properties in Flash Player 10 and Flex “Gumbo”.
Full code after the jump.
To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and installing the Gumbo SDK into Flex Builder 3, see “Using the beta Gumbo SDK in Flex Builder 3″.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/08/02/rotating-an-image-along-its-x-axis-y-axis-and-z-axis-in-flex-and-flash-player-10/ -->
<Application xmlns="http://ns.adobe.com/mxml/2009"
xmlns:mx="library:adobe/flex/halo"
layout="flex.layout.HorizontalLayout">
<Script>
<![CDATA[
private function reset():void {
rXSlider.value = 0;
rYSlider.value = 0;
rZSlider.value = 0;
img.rotationX = 0;
img.rotationY = 0;
img.rotationZ = 0;
}
]]>
</Script>
<mx:Form>
<mx:FormItem label="rotationX:" direction="horizontal">
<mx:HSlider id="rXSlider"
minimum="-360"
maximum="360"
value="0"
snapInterval="2"
tickInterval="30"
liveDragging="true"
width="200"
change="img.rotationX = event.value;" />
<mx:Label text="{rXSlider.value}" />
</mx:FormItem>
<mx:FormItem label="rotationY:" direction="horizontal">
<mx:HSlider id="rYSlider"
minimum="-360"
maximum="360"
value="0"
snapInterval="2"
tickInterval="30"
liveDragging="true"
width="200"
change="img.rotationY = event.value;" />
<mx:Label text="{rYSlider.value}" />
</mx:FormItem>
<mx:FormItem label="rotationZ:" direction="horizontal">
<mx:HSlider id="rZSlider"
minimum="-360"
maximum="360"
value="0"
snapInterval="2"
tickInterval="30"
liveDragging="true"
width="200"
change="img.rotationZ = event.value;" />
<mx:Label text="{rZSlider.value}" />
</mx:FormItem>
<mx:FormItem>
<mx:Button label="Reset" click="reset();" />
</mx:FormItem>
</mx:Form>
<mx:Canvas width="100%" height="100%">
<mx:Image id="img"
source="@Embed('Fx.png')"
width="100"
height="100"
horizontalCenter="0"
verticalCenter="0" />
</mx:Canvas>
</Application>
View source is enabled in the following example.





That is too cool. I am installing the SDK now. Thank you.
I dont understand the properties, why is the X spinning the icon like that? shouldnt the Y and the X properties be the other way around?
As with Raul Riera, I was wondering too.