Home > Flex > Modules Part 3: Adding a Fade In Effect

Modules Part 3: Adding a Fade In Effect

When the module is ready to be displayed, instead of having it pop-up immediately you can have it fade in smoothly.

First, define a bindable DisplayObject for your module in ActionScript:

[Bindable] private var empModule:DisplayObject;

Next, define your effect using MXML:

<mx:Fade id="empFade" target="{empModule}"
alphaFrom="0" alphaTo="1" duration="2000"/>

When the module is ready, set the alpha to 0, add it to your view, then play the effect.

empModule = empRef.factory.create() as DisplayObject;
empModule.alpha = 0;
empCanvas.addChild(empModule);
empFade.play();


Download the Source

Categories: Flex Tags:
  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.