Showing posts with label move. Show all posts
Showing posts with label move. Show all posts

Image move effect

The following example will illustrate the use an effect on component (in this case an image) using your mouse.


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

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

<mx:Script>
<![CDATA[

private function moveAction():void
{
moveImage.end();
moveImage.xTo = mouseX - ( imageAnimation.width / 2);
moveImage.yTo = mouseY - ( imageAnimation.height / 2);
moveImage.play();
}

]]>
</mx:Script>

<mx:Move id="moveImage" target="{imageAnimation}" duration="300"/>

<mx:Canvas width="100%" height="100%"
verticalScrollPolicy="off" horizontalScrollPolicy="off"
click="moveAction()" >

<mx:Image
id="imageAnimation"
source="@Embed('assets/flash_icon.png')" >
</mx:Image>

</mx:Canvas>

</mx:Application>






Click anywhere on the canvas to move the image

 

Labels