Search Flex Components Free

Custom Search

December 25, 2007

Flex Rotate Effect Source Code

Flex Custom Effects Defined Declaratively Sample Source Code:

Create a file:
RotateEffectsDemo.mxml

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundAlpha="0">

<mx:Script>

[Bindable]
public var angle:int=0;

private function rotateImage() : void
{
angle += 45;
rotate.play();
}

</mx:Script>

<mx:Rotate id="rotate" angleFrom="{angle-45}" angleTo="{angle}" target="{img}"/>

<mx:Panel title="Rotate Effect Demo" width="100%" height="100%" horizontalAlign="center">

<mx:Canvas id="canvas" width="100%" height="100%" verticalScrollPolicy="off">

<mx:Image id="img" x="{canvas.width/2 - img.width/2}" y="{canvas.height/2 - img.height/2}"
source="@Embed('../assets/products/Nokia_6630.png')"/>

</mx:Canvas>

<mx:ControlBar>
<mx:Button label="Rotate" click="rotateImage()"/>
</mx:ControlBar>

</mx:Panel>

</mx:Application>

Related Flex Tutorials