Search Flex Components Free

Custom Search

December 25, 2007

Flex Composite Effect Source Code

Flex Custom Effects Defined Programmatically Sample Source Code:
Create a file:
CompositeDemo.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.*;

public function emphasize():void
{
var p:Parallel = new Parallel();

var m:Move = new Move(img);
m.xTo = canvas.width/2 - 50;
m.yTo = canvas.height/2 - 100;

var r:Resize = new Resize(img);
r.widthTo = 100;
r.heightTo = 200;

p.addChild(m);
p.addChild(r);
p.play();
}

public function deemphasize():void
{
var p:Parallel = new Parallel();

var m:Move = new Move(img);
m.xTo = 20;
m.yTo = 20;

var r:Resize = new Resize(img);
r.widthTo = 30;
r.heightTo = 60;

p.addChild(m);
p.addChild(r);
p.play();
}

</mx:Script>

<mx:Panel title="Parallel Effect Demo [Programmatic Approach]" width="100%" height="100%">

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

<mx:Image id="img" x="20" y="20" width="30" height="60"
source="@Embed('../assets/products/Nokia_6630.png')"/>

</mx:Canvas>

<mx:ControlBar>
<mx:Button label="Emphasize" click="emphasize()"/>
<mx:Button label="Deemphasize" click="deemphasize()"/>
</mx:ControlBar>

</mx:Panel>

</mx:Application>

Related Flex Tutorials