Search Flex Components Free

Custom Search

December 25, 2007

Flex Simple Effect Source Code

Flex Custom Effects Defined Programmatically Sample Source Code:
Create a file:

simpleDemo.mxml

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

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

<mx:Script>

import mx.effects.*;

private function moveImage(xTo:int, yTo:int):void
{
var m:Move = new Move(img);
m.xTo = xTo;
m.yTo = yTo;
m.play();
}

</mx:Script>

<mx:Panel title="moveEffect Demo [Programmatic Approach]" width="100%" height="100%"
horizontalAlign="center">

<mx:Label text="Click anywhere on the canvas to move the phone to that position"/>

<mx:Canvas id="canvas" width="100%" height="100%" mouseDown="moveImage(mouseX - 40, mouseY - 80)">

<mx:Image id="img" source="@Embed('../assets/products/Nokia_6630.png')"/>

</mx:Canvas>

</mx:Panel>

</mx:Application>

Related Flex Tutorials