FlashEff2 | ActionScript 3.0 usage


Table of contents

1. Apply FlashEff2 patterns by script

Important! For applying FlashEff2 with code you must use the FlashEff2Code component found in the Components panel. Both, the FlashEff2 and FlashEff2Code components contain the same properties and methods and dispatch the same events. This is a modified version of the FlashEff2 component, which contains all the necessary assets embedded into it. This way you only need to use the FlashEff2Code component and the desired FlashEff2 pattern (they need to be in the Library), without the extra assets the regular FlashEff2 component needs: the presets and easing functions. The downside of the FlashEff2Code is the larger size compared to the FlashEff2 component (up to 6 kB larger).

Creating FlashEff2 animations with actionscript is not so difficult and requires a few steps:

1.1 Create a FlashEff2Code instance

To create FlashEff2Code instance simply instantiate the FlashEff2Code class. In order to do this, the FlashEff2Code component must be placed in the Library of your project. Also the FlashEff2Code component must be added to the display list otherwise it will not work. Finally it must be applied on the target display object (Sprite, MovieClip or dynamic TextField).

var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.showAutoPlay = true;
myEffect.hideDelay = 3;
addChild(myEffect);

... set up the FlashEff2 pattern ...

myEffect._targetInstanceName = "myClip";

1.2 Apply the FlashEff2 pattern

FlashEff2 patterns can be applied in two different ways: either by creating an instance of that pattern and assigning it to the FlashEff2Code instance or by setting the pattern class name.

import com.jumpeye.flashEff2.symbol.alpha.FESAlpha;
var myPattern:FESAlpha = new FESAlpha();
myPattern.tweenDuration = 0.5;
myEffect.showTransition = myPattern;

... or ...

myEffect.showTransitionName = "com.jumpeye.flashEff2.symbol.alpha.FESAlpha";
myEffect.showTransition.tweenDuration = 0.5;

1.3 Check to see when the transition ends

The beginning and ending of an effect is announced by the component through events. You need to add listeners for the FLASHEFFEvents.TRANSITION_START (the event for the beginning of the effect) and FLASHEFFEvents.TRANSITION_END (the event for the end of the effect) events.

import com.jumpeye.Events.FLASHEFFEvents;

myEffect.addEventListener(FLASHEFFEvents.TRANSITION_START, effectStarting);
myEffect.addEventListener(FLASHEFFEvents.TRANSITION_END, effectEnding);

function effectStarting(evt:FLASHEFFEvents):void {
     trace("The effect has started");
}

function effectEnding(evt:FLASHEFFEvents):void {
     trace("The effect has endded");
}

2. Examples

2.1 Create a looping show/hide effect

Create a new ActionScript 3.0 file, set the frame rate to 30 fps and place an image on the stage. Convert it into a MovieClip and give it the instance name of "myImage".

Open the Components Panel and drag the FlashEff2Code component (FlashEff2 folder) over the Library panel. Do so with the FESBrightSquares and FESEqualizer patterns too (FlashEff2 Patterns folder). We will be creating a show effect using the FESBrightSquares pattern and a hide effect using the FESEqualizer pattern.

Next, in the timeline panel, create a new layer and name it "Actions". This is where you will be placing the code. Select the first frame in the "Actions" layer, open the Actions panel (F9) and paste the code below in the panel:

// Import the necessary classes.
import com.jumpeye.Events.FLASHEFFEvents;
import com.jumpeye.flashEff2.symbol.brightSquares.FESBrightSquares;
import com.jumpeye.flashEff2.symbol.equalizer.FESEqualizer;

// Create the FlashEff2Code instance and add it to the stage. The FlashEff2Code
// component must be in the display list in order for it to work.
var effect:FlashEff2Code = new FlashEff2Code();
effect.addEventListener(FLASHEFFEvents.TRANSITION_END, replay);
addChild(effect);

// Create the show pattern instance (FESBrightSquares) and set it
// so the effect looks as you like.
var showEffect:FESBrightSquares = new FESBrightSquares();
showEffect.scaleXAmount = 1.5;
showEffect.scaleYAmount = 1.5;
showEffect.preset = 19; // random
showEffect.tweenDuration = 2;

// Create the hide pattern instance (FESEqualizer) and set it
// so the effect looks as you like.
var hideEffect:FESEqualizer = new FESEqualizer();
hideEffect.squareWidth = 15;
hideEffect.squareHeight = 15;
hideEffect.preset = 3; // T2B
hideEffect.tweenDuration = 3;

// Assign the show and hide transitions to the FlashEff2Code instance.
effect.showTransition = showEffect;
effect.hideTransition = hideEffect;
// There will be a 3 seconds pause between the show and hide transitions.
effect.hideDelay = 3;
// Set the target object to the FlashEff2Code instance. Once you do this,
// the show effect will start immediately (except the case when the
// show effect has a delay too).
effect._targetInstanceName = "myImage";

// When the "hide" transition ends, start the show effect again.
function replay(evt:FLASHEFFEvents):void {
     if (effect.currentTransitionType == "hide")
          effect.show();
}

Test your clip by pressing Ctr+Enter for Windows or Cmd+Enter on Mac OS.

2.2 Apply a FlashEff2 filter

Create a new ActionScript 3.0 file, set the frame rate to 30 fps and place an image on the stage. Convert it into a MovieClip and give it the instance name of "myImage".

Open the Components Panel and drag the FlashEff2Code component (FlashEff2 folder) over the Library panel. Do so with the FEFReflection pattern too (FlashEff2 Patterns folder). We will be applying a reflection to the target image, through the FlashEff2Code component.

Next, in the timeline panel, create a new layer and name it "Actions". This is where you will be placing the code. Select the first frame in the "Actions" layer, open the Actions panel (F9) and paste the code below in the panel:

// Import the necessary classes.
import com.jumpeye.Events.FLASHEFFEvents;
import com.jumpeye.flashEff2.filter.reflection.FEFReflection;

// Create the FlashEff2Code instance and add it to the stage. The FlashEff2Code
// component must be in the display list in order for it to work.
var effect:FlashEff2Code = new FlashEff2Code();
addChild(effect);

// Create the reflection filter instance and set it up as you need.
var reflection:FEFReflection = new FEFReflection();
reflection.refresh = false;
reflection.reflectionAlpha = 0.8;
reflection.reflectionRatio = 160;

// Add the filter to the FlashEff2Code instance.
effect.addFilter(reflection);
// Set the target object to the FlashEff2Code instance. Once you do this,
// the filter will be applied immediately.
effect._targetInstanceName = "myImage";

Test your clip by pressing Ctr+Enter for Windows or Cmd+Enter on Mac OS.

2.3 Create a FlashEff2 button

Create a new ActionScript 3.0 file, set the frame rate to 30 fps and place an image on the stage. Convert it into a MovieClip and give it the instance name of "myImage".

Open the Components Panel and drag the FlashEff2Code component (FlashEff2 folder) over the Library panel. Do so with the FEBEffect pattern too (FlashEff2 Patterns folder). All the button effects are applied using a single pattern.

Now, applying settings on the FEBEffect pattern instance is done through XML objects. Each FlashEff2 button has three states (up, over and down) and you can apply different settings for each of the states. This however, is done not by assigning values to the pattern parameters but by assigning an XML object to each of the three states, that actually are the button parameters (upState, overState and downState). You can see all the possible button settings inside the FlashEff2 Panel > Button tab.

Note: This is why it is harder to create the button effects by code and we recommend using the FlashEff2 Panel to apply button effects. The easiest way to get the XML object corresponding to the button states is to make the button settings first using the FlashEff2 Panel and then click on the Copy button. This will copy the XML object corresponding to the entire FlashEff2 instance into the clipboard and from there you can paste it into any text editor you like. Then, simply copy the contents of the <value> nodes inside the <upState>, <overState> and <downState> nodes and paste them into the code in your .fla file.

Next, in the timeline panel, create a new layer and name it "Actions". This is where you will be placing the code. Select the first frame in the "Actions" layer, open the Actions panel (F9) and paste the code below in the panel:

// Import the necessary classes.
import com.jumpeye.Events.FLASHEFFEvents;
import com.jumpeye.flashEff2.buttonEffect.FEBEffect;

// Create the FlashEff2Code instance and add it to the stage. The FlashEff2Code
// component must be in the display list in order for it to work.
var effect:FlashEff2Code = new FlashEff2Code();
addChild(effect);

var overStateXML:XML = <value>
                           <tweenDuration>
                                <type>Number</type>
                                <value>0.3</value>
                                <defaultValue>0.3</defaultValue>
                                <enterValue>0.3</enterValue>
                           </tweenDuration>
                           <tweenType>
                                <type>String</type>
                                <value>Quadratic</value>
                                <defaultValue>Quadratic</defaultValue>
                                <enterValue>Quadratic</enterValue>
                           </tweenType>
                           <easeType>
                                <type>String</type>
                                <value>easeOut</value>
                                <defaultValue>easeOut</defaultValue>
                                <enterValue>easeOut</enterValue>
                           <easeType>
                           <glowFilter>
                                <type>Object</type>
                                <value>
                                     <color>
                                          <type>uint</type>
                                          <value>26367</value>
                                          <defaultValue>14492194</defaultValue>
                                     </color>
                                     <alpha>
                                          <type>Number</type>
                                          <value>1</value>
                                          <defaultValue>1</defaultValue>
                                     </alpha>
                                     <blurX>
                                          <type>Number</type>
                                          <value>10</value>
                                          <defaultValue>10</defaultValue>
                                     </blurX>
                                     <blurY>
                                          <type>Number</type>
                                          <value>10</value>
                                          <defaultValue>10</defaultValue>
                                     </blurY>
                                     <strength>
                                          <type>Number</type>
                                          <value>3</value>
                                          <defaultValue>2</defaultValue>
                                     </strength>
                                     <quality>
                                          <type>Number</type>
                                          <value>3</value>
                                          <defaultValue>2</defaultValue>
                                     </quality>
                                     <inner>
                                          <type>Boolean</type>
                                          <value>false</value>
                                          <defaultValue>false</defaultValue>
                                     </inner>
                                     <knockout>
                                          <type>Boolean</type>
                                          <value>false</value>
                                          <defaultValue>false</defaultValue>
                                     </knockout>
                                </value>
                           </glowFilter>
                       </value>;

var downStateXML:XML = <value>
                           <tweenDuration>
                                <type>Number</type>
                                <value>0.15</value>
                                <defaultValue>0.15</defaultValue>
                                <enterValue>0.3</enterValue>
                           <tweenDuration></tweenDuration>
                           <tweenType>
                                <type>String</type>
                                <value>Strong</value>
                                <defaultValue>Strong</defaultValue>
                                <enterValue>Quadratic</enterValue>
                           </tweenType>
                           <easeType>
                                <type>String</type>
                                <value>easeOut</value>
                                <defaultValue>easeOut</defaultValue>
                                <enterValue>easeOut</enterValue>
                           </easeType>
                           <glowFilter>
                                <type>Object</type>
                                <value>
                                     <color>
                                          <type>uint</type>
                                          <value>0</value>
                                     </color>
                                     <alpha>
                                          <type>Number</type>
                                          <value>0.7</value>
                                     </alpha>
                                     <blurX>
                                          <type>Number</type>
                                          <value>8</value>
                                     </blurX>
                                     <blurY>
                                          <type>Number</type>
                                          <value>8</value>
                                     </blurY>
                                     <quality>
                                          <type>Number</type>
                                          <value>2</value>
                                     </quality>
                                     <inner>
                                          <type>Boolean</type>
                                          <value>true</value>
                                     </inner>
                                     <knockout>
                                          <type>Boolean</type>
                                          <value>false</value>
                                     </knockout>
                                     <strength>
                                          <type>Number</type>
                                          <value>2</value>
                                     </strength>
                                </value>
                           </glowFilter>

                           <blurFilter>
                                <type>Object</type>
                                <value>
                                     <blurX>
                                          <type>Number</type>
                                          <value>4</value>
                                     </blurX>
                                     <blurY>
                                          <type>Number</type>
                                          <value>4</value>
                                     </blurY>
                                     <quality>
                                          <type>Number</type>
                                          <value>1</value>
                                     </quality>
                                </value>
                           </blurFilter>
                       </value>;

// Create the button pattern instance.
var btnEffect:FEBEffect = new FEBEffect();
// The up state of the button will have no effects so the upState
// property will not be set.
btnEffect.overState = overStateXML;
btnEffect.downState = downStateXML;

// Apply the button pattern to the FlashEff2Code instance.
effect.buttonEffect = btnEffect;
effect.useHandCursor = true;
// Set the target object to the FlashEff2Code instance. Once you do this,
// the button pattern will be immediately applied.
effect._targetInstanceName = "myButton";

Test your clip by pressing Ctr+Enter for Windows or Cmd+Enter on Mac OS.

2.4 Create a looping show/hide effect on text

Create a new ActionScript 3.0 file and set the frame rate to 30 fps. This example shows you how to create and set up a text field to be used with FlashEff2.

Open the Components Panel and drag the FlashEff2Code component (FlashEff2 folder) over the Library panel. Do so with the FETMagneticWind and FETXYScale patterns too (FlashEff2 Patterns folder). We will be creating a show effect using the FETMagneticWind pattern and a hide effect using the FETXYScale pattern.

The font used for the text is "Lucida Sans" so this font should be placed into the Library Panel to be compiled into the final .swf clip. To embed a font into the Library, please follow our tutorial on the JumpeyeComponents site: http://www.jumpeyecomponents.com/Flash-Components/Transition-Effects/TxEff-Full-License-123/embed-fonts.htm.

Next, in the timeline panel, select the current layer and name it "Actions". This is where you will be placing the code. This file will not contain objects on the stage, instead they will be created by code. Select the first frame in the "Actions" layer, open the Actions panel (F9) and paste the code below in the panel:

// Import the necessary classes.
import com.jumpeye.Events.FLASHEFFEvents;
import com.jumpeye.flashEff2.text.magneticWind.FETMagneticWind;
import com.jumpeye.flashEff2.text.xyscale.FETXYScale;

// Create the text format for the font.
var txtFormat:TextFormat = new TextFormat();
txtFormat.font = "Lucida Sans";
txtFormat.align = "center";
txtFormat.color = 0x0099FF;
txtFormat.size = 40;

// Create the text field, set it up and add it to the display list.
var myText:TextField = new TextField();
myText.type = "dynamic";
myText.embedFonts = true;
myText.antiAliasType = "advanced";
myText.multiline = true;
myText.wordWrap = true;
myText.autoSize = "center";
addChild(myText);
// Add the text into the text field (text should be as HTML).
myText.defaultTextFormat = txtFormat;
myText.htmlText = "The quick brown fox jumps over the lazy dog";
// Center the text field on the stage.
myText.width = 350;
myText.x = (stage.stageWidth - myText.width) / 2;
myText.y = (stage.stageHeight - myText.height) / 2;

// Create the FlashEff2Code instance and add it to the stage. The FlashEff2Code
// component must be in the display list in order for it to work.
var effect:FlashEff2Code = new FlashEff2Code();
effect.addEventListener(FLASHEFFEvents.TRANSITION_END, replay);
addChild(effect);

// Create the show pattern instance (FESBrightSquares) and set it
// so the effect looks as you like.
var showEffect:FETMagneticWind = new FETMagneticWind();
showEffect.randomX = 200;
showEffect.randomY = 50;
showEffect.groupDuration = 1.5;
showEffect.tweenDuration = 2;

// Create the hide pattern instance (FESEqualizer) and set it
// so the effect looks as you like.
var hideEffect:FETXYScale = new FETXYScale();
hideEffect.positionX = -15;
hideEffect.positionY = -50;
hideEffect.preset = 9; // char: random
hideEffect.groupDuration = 1.5;
hideEffect.tweenDuration = 2;

// Assign the show and hide transitions to the FlashEff2Code instance.
effect.showTransition = showEffect;
effect.hideTransition = hideEffect;
// There will be a 3 seconds pause between the show and hide transitions.
effect.hideDelay = 3;
// Set the target text field to the FlashEff2Code instance. Once you do this,
// the show effect will start immediately (except the case when the
// show effect has a delay too).
effect.target = myText;

// When the "hide" transition ends, start the show effect again.
function replay(evt:FLASHEFFEvents):void {
     if (effect.currentTransitionType == "hide")
          effect.show();
}

Test your clip by pressing Ctr+Enter for Windows or Cmd+Enter on Mac OS.

3. Properties

Property Type/FlashEff2 panel Description
_targetInstanceName String
Yes
The instance name of the target object on which the effect will be applied. If the target object and the FlashEff2Code instance do not have the same direct parent, then the target property should be used instead of _targetInstanceName, to set the reference to the target object using its path on the time line. Once this property is set, the component immediately tries to apply the effects, only if the showAutoPlay or hideAutoPlay property is set to true. This property must be set after both the target object and the FlashEff2Code component were added to the display list.

Example
The next example applies a show transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.showTransitionName = "com.jumpeye.flashEff2.symbol.alpha. FESAlpha";
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
trace(myEffect._targetInstanceName); // myClip
buttonEffect IFlashEffButtonEffect
No
A reference to the instance of the ButtonEffect pattern currently applied to the target object, through the current instance of FlashEff2. This reference is created separately by using the pattern's constructor.

In the FlashEff2 panel, the desired button effect can be selected from the Button tab -> Pattern list.

Example
The next example applies scaling actions (FEBScale) to a clip (symbol) called myClip, executed when mouse actions take place on the target clip.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FEBScale pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.buttonEffect.scale. FEBScale;

var myPattern:FEBScale = new FEBScale();
myPattern.tweenDuration = 0.25;
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.buttonEffect = myPattern;
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
buttonEffectName String
No
The name of the ButtonEffect pattern applied to the target object. This represents the full path and class name of the pattern.

In the FlashEff2 panel, the desired panel can be selected from the Button tab -> Pattern list.

Example
The next example applies scaling actions (FEBScale) to a clip (symbol) called myClip, executed when mouse actions take place on the target clip.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FEBScale pattern into the Library. Bring up the Actions panel and paste the following code into it:

var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.buttonEffectName = "com.jumpeye.flashEff2.buttonEffect. scale.FEBScale";
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
commands Array
No
[read-only] The list of Command patterns applied to the target object. The patterns are inserted into the list in the order they are applied to the target object. If you need the reference to the third pattern applied, you can retrieve it just like you would retrieve any item from an Array object:
var myCommand:FECNavigateToURL = myEffect.commands[2];

In the FlashEff2 panel, Command patterns can be selected from the Commands area in the Button tab.

Example
This example lists all the commands applied to the target object, in this case, a single navigateToURL command (FECNavigateToURL).

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FECNavigateToURL pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.command. navigateToURL.FECNavigateToURL;

var myPattern:FECNavigateToURL = new FECNavigateToURL();
myPattern.url = "http://www.flasheff.com/";
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.addCommand(myPattern, "release");
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
for(var i:int = 0; i < myEffect.commands.length; i++)
     trace(i+" :: "+myEffect.commands[i]); // 0 :: [object FECNavigateToURL]
currentTransitionType String
No
[read-only] Specifies the type of the current transition on a symbol or text object. Possible values are show, hide and swap. Useful when a FLASHEFFEvents.TRANSITION_END is dispatched and you want to find out the type of transition that has just finished.

Example
The next example applies a show transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip. The FlashEff2Code component instance will dispatch events when the transition starts and when it ends.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FETAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.symbol. alpha.FESAlpha;
import com.jumpeye.Events.FLASHEFFEvents;

var myPattern:FESAlpha = new FESAlpha();
var myEffect:FlashEff2Code = new FlashEff2Code();

myEffect.showTransition = myPattern;
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
myEffect.addEventListener(FLASHEFFEvents. TRANSITION_START, transitionStartHandler);
myEffect.addEventListener(FLASHEFFEvents. TRANSITION_END, transitionEndHandler);

function transitionStartHandler(evtObj: FLASHEFFEvents):void {
     trace("The" + evtObj.target.currentTransitionType + "transition has started.");
}

function transitionEndHandler(evtObj: FLASHEFFEvents):void {
     trace("The" + evtObj.target.currentTransitionType + "transition has ended.");
}
drawAfterFilters Boolean
Yes
If true, the button effect will be applied on the entire target object, including any auxiliary elements it might have, like filter patterns. Otherwise the button pattern will be applied only to the target object, without affecting the other patterns it might have, for example filter patterns.

For example, if a reflection filter has been applied to the target object and drawAfterFilters is true, the FEBScale button pattern will scale the target object, including the reflection, on rollover and press mouse actions.

The default value is true.

Example
This example adds a button filter (FEBScale) which scales the target on mouse actions. The target object, in this case, also has a reflection filter applied on it (FEFReflection).

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FEFReflection pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.filter. reflection.FEFReflection;
import com.jumpeye.flashEff2. buttonEffect.scale.FEBScale;

var reflection:FEFReflection = new FEFReflection();
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.addFilter(reflection);
var myPattern:FEBScale = new FEBScale();
myPattern.tweenDuration = 0.25;
myEffect.buttonEffect = myPattern;
myEffect.drawAfterFilters = false;
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
filterList Array
No
[read-write] The list of Filter patterns applied to the target object. No The patterns are inserted into the list in the order they are applied to the target object. If you need the reference to the third filter applied, you can retrieve it just like you would retrieve any item from an Array object:
var myFilter:FilterEffect = myEffect.filterList[2];

In the FlashEff2 panel, the desired panel can be selected from the Filter tab -> Pattern list.

Example
This example lists all the filters applied to the target object, in this case, a single reflection filter (FEFReflection).

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FEFReflection pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.filter. reflection.FEFReflection;

var myPattern:FEFReflection = new FEFReflection();
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.addFilter(myPattern);
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
for(var i:int = 0; i < myEffect.filterList.length; i++)
     trace(i+" :: "+myEffect.filterList[i]); // 0 :: [object FEFReflection]
hideAutoPlay Boolean
No
This property controls the hide transition applied to the target object (symbol or text field). If true, the transition will be applied after the time delay specified at hideDelay and after all the necessary properties were set. If false, the hide transition will have to be called through ActionScript code, using the transitionEffect() or hide() methods. This property can also be set in the FlashEff2 panel by selecting the "autoPlay" option in the Hide tab.

The default value is true.

Example
The next example applies automatically a show transition based on the Alpha pattern (FESAlpha), on a target clip (symbol) called myClip. Since hideAutoPlay is set to false, the hide transition will not occur automatically. We'll have to specifically tell the component to hide the clip when a mouse click is executed on it.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.showTransitionName = "com. jumpeye.flasheff2.symbol.alpha.FESAlpha";
myEffect.hideTransitionName = "com. jumpeye.flasheff2.symbol.alpha.FESAlpha";
this.addChild(myEffect);
myEffect.showAutoPlay = true;
myEffect.hideAutoPlay = false;
myEffect._targetInstanceName = "myClip";
myClip.addEventListener(MouseEvent. CLICK, clickHandler);

function clickHandler(event:MouseEvent):void {
     myEffect.hide();
}
hideDelay Number
Yes
The time interval, measured in seconds, until the hide transition should start. This property is used only if hideAutoPlay is true. The property also accepts floating point numbers, so you can set time intervals with milliseconds precision. This property can be set in the FlashEff2 panel -> Hide tab -> "delay" option.

The default value is 2.

Example
The next example applies a hide transition based on the Alpha pattern (FESAlpha), on a target clip (symbol) called myClip, after a 5 seconds delay.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.hideTransitionName = "com. jumpeye.flasheff2.symbol.alpha.FESAlpha";
this.addChild(myEffect);
myEffect.hideDelay = 5;
myEffect._targetInstanceName = "myClip";
hideTransition IFlashEffSymbolText
No
A reference to the instance of the pattern used for the hide transition. When used from code, this reference is created separately by using the pattern's constructor. Otherwise the hide pattern can be selected from FlashEff2 panel -> Hide tab -> Pattern list.

Example
The next example applies a hide transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.symbol. alpha.FESAlpha;

var myPattern:FESAlpha = new FESAlpha();
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.hideTransition = myPattern;
myEffect.hideDelay = 0;
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
hideTransitionName String
No
The full path and class name of the pattern used for the hide transition. This hide transition switches the target from a visible state to an invisible state, using an effect provided by the selected pattern. If you need to apply a hide transition on a target object, first you have to set that pattern to the FlashEff2Code instance either by setting the hideTransitionName or the hideTransition property or by selecting a pattern in FlashEff2 panel -> Hide tab -> Pattern list.

Example
The next example applies a hide transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip. The transition is applied with a two seconds delay because, by default, hideDelay is 2. If you would like the effect to run immediately, set the hideDelay property to 0.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.hideTransitionName = "com. jumpeye.flasheff2.symbol.alpha.FESAlpha";
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
isTargetVisibleAtEnd Boolean
No
Controls the way the text looks after the effect applied on it has ended. If true, the text will be displayed in the original form (might slightly differ in position from the text with effect). If false, the text will remain in the final state after the effect has ended. This final state is not necessarily the original text field, it might by only a copy of it, on which the actual effect was applied.

If removeEffect() is called during the show on the text field and the property is set to true after the transition stops, the object displayed will be the original text field and not the Bitmap copy of it.

If the property is set to true, it is recommended that the x and y coordinates of the target object are integer values, otherwise you may experience some position shifting after the transition has ended and the target text field is displayed in the initial state.

The default value is false.

Example
The next example applies a show transition based on the Alpha pattern (FETAlpha), to a text field called myTextField and after the transition has finished and leaves the original text field displayed and not a Bitmap copy of it, the text field will be selectable.

Place a dynamic, selectable text field on the stage, enter the "The quick brown fox jumps over the lazy dog" text into it and give it an instance name of myTextField. Set the anti-alias setting to "Anti-alias for animation", enable the "Render text as HTML" option and embed the characters using the Auto Fill option in the Embed characters dialog box. Next, from the Components panel drag the FlashEff2Code component and the FETAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.text.alpha. FETAlpha;

var myPattern:FETAlpha = new FETAlpha();
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.showTransition = myPattern;
myEffect.isTargetVisibleAtEnd = true;
this.addChild(myEffect);
myEffect._targetInstanceName = "myTextField";
isTransitioning Boolean
No
Specifies whether there is a transition going on (true) or not (false).

Example
The next example applies a hide transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip. The transition is applied with a 1 second delay. We are also setting up a handler for the ENTER_FRAME event, so each time the clip enters a new frame, the isTransitioning property is checked for it's value. Once it changes, the value is displayed.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.symbol. alpha.FESAlpha;

var isTransitionHappening:Boolean;
var myPattern:FESAlpha = new FESAlpha();
var myEffect:FlashEff2Code = new FlashEff2Code();

myEffect.showTransition = myPattern;
myEffect.showDelay = 1;
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
isTransitionHappening = true;
this.addEventListener(Event.ENTER_FRAME, loop);

function loop(event:Event):void {
     if (isTransitionHappening != myEffect.isTransitioning) {
          trace((myEffect.isTransitioning ? "transition in course" : "no transition at the moment"));
          isTransitionHappening = myEffect.isTransitioning;
     }
}

In the Output panel the clip will trace the values of the isTransitioning property while the clip is running:

no transition at the moment
transition in course
no transition at the moment
showAutoPlay Boolean
Yes
This property controls the show transition applied to the target object. If true, the transition will be applied after the time delay specified at showDelay and after all the necessary properties were set. If false, the show transition will have to be called through ActionScript code, using the transitionEffect() or show() methods. This property can also be set in the FlashEff2 panel by selecting the "autoPlay" option in the Show tab.

The default value is true.

Example
The next example applies a consecutive show and hide transition based on the Alpha pattern (FESAlpha), on a target clip (symbol) called myClip. Since hideAutoPlay is set to true, the hide transition will occur automatically after 3 seconds after the show transition. The show transition however will not occur (showAutoPlay is false) until we specifically tell the component to show the clip when a mouse click is executed on it.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.showTransitionName = "com. jumpeye.flasheff2.symbol.alpha.FESAlpha";
myEffect.hideTransitionName = "com. jumpeye.flasheff2.symbol.alpha.FESAlpha";
this.addChild(myEffect);
myEffect.showAutoPlay = false;
myEffect.hideDelay = 5;
myEffect.hideAutoPlay = true;
myEffect._targetInstanceName = "myClip";
myClip.addEventListener(MouseEvent.CLICK, clickHandler);

function clickHandler(event:MouseEvent):void {
     myEffect.show();
}
showDelay Number
Yes
The time interval, measured in seconds, until the show transition should start. This property is used only if showAutoPlay is true. The property also accepts floating point numbers, so you can set time intervals with milliseconds precision. This property can be set from the FlashEff2 panel -> Show tab -> "delay" option.

The default value is 2.

Example
The next example applies a show transition based on the Alpha pattern (FESAlpha), on a target clip (symbol) called myClip, after a 5 seconds delay.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

var myEffect:FlashEff2Code = new FlashEff2Code(); myEffect.showTransitionName = "com. jumpeye.flasheff2.symbol.alpha.FESAlpha"; this.addChild(myEffect); myEffect.showDelay = 5; myEffect._targetInstanceName = "myClip";
showTransition IFlashEffSymbolText
No
A reference to the instance of the pattern used for the show transition. This reference is created separately by using the pattern's constructor. Otherwise the show pattern can be selected from FlashEff2 panel -> Show tab -> Pattern list.

Example
The next example applies a show transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.symbol. alpha.FESAlpha;

var myPattern:FESAlpha = new FESAlpha();
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.showTransition = myPattern;
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
showTransitionName String
No
The full path and class name of the pattern used for the show transition. This show transition switches the target from an invisible state to a visible state, using an effect provided by the selected pattern. If you need to apply a show transition to a target object, first you have to set that pattern to the FlashEff2Code instance either by setting the showTransitionName or the showTransition property or by selecting a pattern in FlashEff2 panel -> Show tab -> Pattern list.

Example
The next example applies a show transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.showTransitionName = "com. jumpeye.flasheff2.symbol.alpha.FESAlpha";
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
swapDelay Number
Yes
The delay used for the swap transition - the time interval between the start of the hide transition on the current target and the start of the show transition on the next target. If swapDelay is 0 then the hide on the current target and the show on the next target take place in the same time, meaning that this is a crossfade-like transition between the two objects. If swapDelay is larger than the duration of the hide transition then the two target objects will be displayed one after the other (the current target hides and then the next target is displayed).

The default value is 0.

Example
The next example applies a show transition based on the Alpha pattern (FETAlpha) to a text field called myTextField1 and then swaps the text field with another one called myTextField2. The swap operation hides the first text field using the Blur pattern (FETBlur) and then displays the second text field at the same time with the Alpha pattern.

Place two dynamic text fields on the stage, enter the "This is the first text field" text into one of them and "This is the second text field" text into he other and give them instance names of myTextField1 for the first text field and myTextField2 for the second one. Change the anti-alias setting to "Anti-alias for animation", enable the "Render text as HTML" option and embed the characters using the Auto Fill option in the Embed characters dialog box for both text fields. Next, from the Components panel drag the FlashEff2Code component and the FETAlpha and FETBlur patterns into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.text.alpha. FETAlpha;
import com.jumpeye.flashEff2.text.blur. FETBlur;

var showPattern1:FETAlpha = new FETAlpha();
var showPattern2:FETAlpha = new FETAlpha();
var hidePattern:FETBlur = new FETBlur();
var myEffect:FlashEff2Code = new FlashEff2Code();

myEffect.targetVisibility = false;
myEffect.showTransition = showPattern1;
myEffect.hideTransition = hidePattern;
myEffect.useSwapInsteadHide = true;
myEffect.swapType = FlashEff2.SWAP_TYPE_HIDE_AND_SHOW;
myEffect.swapTransition = showPattern2;
myEffect.swapDelay = 0;
myEffect.swapTargetVisibility = false;

this.addChild(myEffect);
myEffect.swapTargetInstanceName = "myTextField2";
myEffect._targetInstanceName = "myTextField1";
swapTarget DisplayObject
No
The reference to the second target object used for the swap transition. The second target object of the swap transition is the one on which the show transition is executed. This property must be set after both the target object and the FlashEff2Code component were added to the display list.

Example
The next example applies a show transition based on the Alpha pattern (FETAlpha) to a text field called myTextField1 and then swaps the text field with another one called myTextField2. The swap operation hides the first text field using the Blur pattern (FETBlur) and then displays the second text field at the same time with the Alpha pattern.

Place two dynamic text fields on the stage, enter the "This is the first text field" text into one of them and "This is the second text field" text into he other and give them instance names of myTextField1 for the first text field and myTextField2 for the second one. Change the anti-alias setting to "Anti-alias for animation", enable the "Render text as HTML" option and embed the characters using the Auto Fill option in the Embed characters dialog box for both text fields. Next, from the Components panel drag the FlashEff2Code component and the FETAlpha and FETBlur patterns into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.text.alpha. FETAlpha;
import com.jumpeye.flashEff2.text.blur. FETBlur;

var showPattern1:FETAlpha = new FETAlpha();
var showPattern2:FETAlpha = new FETAlpha();
var hidePattern:FETBlur = new FETBlur();
var myEffect:FlashEff2Code = new FlashEff2Code();

myEffect.targetVisibility = false;
myEffect.showTransition = showPattern1;
myEffect.hideTransition = hidePattern;
myEffect.useSwapInsteadHide = true;
myEffect.swapType = FlashEff2.SWAP_TYPE_HIDE_AND_SHOW;
myEffect.swapTransition = showPattern2;
myEffect.swapDelay = 0;
myEffect.swapTargetVisibility = false;

this.addChild(myEffect);
myEffect.swapTarget = myTextField2;
myEffect._targetInstanceName = "myTextField1";
swapTargetInstance Name String
Yes
The instance name of the second target object used for the swap transition. The second target object of the swap transition is the one on which the show transition is executed. This property must be set after both the target object and the FlashEff2Code component were added to the display list.

Example
The next example applies a show transition based on the Alpha pattern (FETAlpha) to a text field called myTextField1 and then swaps the text field with another one called myTextField2. The swap operation hides the first text field using the Blur pattern (FETBlur) and then displays the second text field at the same time with the Alpha pattern.

Place two dynamic text fields on the stage, enter the "This is the first text field" text into one of them and "This is the second text field" text into he other and give them instance names of myTextField1 for the first text field and myTextField2 for the second one. Change the anti-alias setting to "Anti-alias for animation", enable the "Render text as HTML" option and embed the characters using the Auto Fill option in the Embed characters dialog box for both text fields. Next, from the Components panel drag the FlashEff2Code component and the FETAlpha and FETBlur patterns into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.text.alpha. FETAlpha;
import com.jumpeye.flashEff2.text.blur. FETBlur;

var showPattern1:FETAlpha = new FETAlpha();
var showPattern2:FETAlpha = new FETAlpha();
var hidePattern:FETBlur = new FETBlur();
var myEffect:FlashEff2Code = new FlashEff2Code();

myEffect.targetVisibility = false;
myEffect.showTransition = showPattern1;
myEffect.hideTransition = hidePattern;
myEffect.useSwapInsteadHide = true;
myEffect.swapType = FlashEff2.SWAP_TYPE_HIDE_AND_SHOW;
myEffect.swapTransition = showPattern2;
myEffect.swapDelay = 0;
myEffect.swapTargetVisibility = false;

this.addChild(myEffect);
myEffect.swapTargetInstanceName = "myTextField2";
myEffect._targetInstanceName = "myTextField1";
swapTargetVisibility Boolean
Yes
A Boolean value which specifies whether the second target object of the swap transition is visible (true) before the swap transition starts or invisible (false). The second target object of the swap transition is the one on which the show transition is executed.

The default value is false.

Example
The next example applies a show transition based on the Alpha pattern (FETAlpha) to a text field called myTextField1 and then swaps the text field with another one called myTextField2. The swap operation hides the first text field using the Blur pattern (FETBlur) and then displays the second text field at the same time with the Alpha pattern. The second text field will be visible before the swap transition starts, because swapTargetVisibility is set to true.

Place two dynamic text fields on the stage, enter the "This is the first text field" text into one of them and "This is the second text field" text into he other and give them instance names of myTextField1 for the first text field and myTextField2 for the second one. Change the anti-alias setting to "Anti-alias for animation", enable the "Render text as HTML" option and embed the characters using the Auto Fill option in the Embed characters dialog box for both text fields. Next, from the Components panel drag the FlashEff2Code component and the FETAlpha and FETBlur patterns into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.text.alpha. FETAlpha;
import com.jumpeye.flashEff2.text.blur. FETBlur;

var showPattern1:FETAlpha = new FETAlpha();
var showPattern2:FETAlpha = new FETAlpha();
var hidePattern:FETBlur = new FETBlur();
var myEffect:FlashEff2Code = new FlashEff2Code();

myEffect.targetVisibility = false;
myEffect.showTransition = showPattern1;
myEffect.hideTransition = hidePattern;
myEffect.useSwapInsteadHide = true;
myEffect.swapType = FlashEff2.SWAP_TYPE_HIDE_AND_SHOW;
myEffect.swapTransition = showPattern2;
myEffect.swapDelay = 0;
myEffect.swapTargetVisibility = true;

this.addChild(myEffect);
myEffect.swapTargetInstanceName = "myTextField2";
myEffect._targetInstanceName = "myTextField1";
swapTransition IFlashEffSymbolText
No
A reference to the instance of the pattern used for the swap transition. This reference is created separately by using the pattern's constructor.

Example
The next example applies a show transition based on the Alpha pattern (FETAlpha) to a text field called myTextField1 and then swaps the text field with another one called myTextField2. The swap operation hides the first text field using the Blur pattern (FETBlur) and then displays the second text field at the same time with the Alpha pattern.

Place two dynamic text fields on the stage, enter the "This is the first text field" text into one of them and "This is the second text field" text into he other and give them instance names of myTextField1 for the first text field and myTextField2 for the second one. Change the anti-alias setting to "Anti-alias for animation", enable the "Render text as HTML" option and embed the characters using the Auto Fill option in the Embed characters dialog box for both text fields. Next, from the Components panel drag the FlashEff2Code component and the FETAlpha and FETBlur patterns into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.text.alpha. FETAlpha;
import com.jumpeye.flashEff2.text.blur. FETBlur;

var showPattern1:FETAlpha = new FETAlpha();
var showPattern2:FETAlpha = new FETAlpha();
var hidePattern:FETBlur = new FETBlur();
var myEffect:FlashEff2Code = new FlashEff2Code();

myEffect.targetVisibility = false;
myEffect.showTransition = showPattern1;
myEffect.hideTransition = hidePattern;
myEffect.useSwapInsteadHide = true;
myEffect.swapType = FlashEff2.SWAP_TYPE_HIDE_AND_SHOW;
myEffect.swapTransition = showPattern2;
myEffect.swapDelay = 0;
myEffect.swapTargetVisibility = false;

this.addChild(myEffect);
myEffect.swapTargetInstanceName = "myTextField2";
myEffect._targetInstanceName = "myTextField1";
swapTransitionName String
Yes
The full path and class name of the pattern used for the swap transition. Practically this is the pattern that will execute the show transition on the second target object. If there is no pattern name specified, the pattern used will be the one specified at showTransitionName or showTransition (if it is the case).

Example
The next example applies a show transition based on the Alpha pattern (FETAlpha) to a text field called myTextField1 and then swaps the text field with another one called myTextField2. The swap operation hides the first text field using the Blur pattern (FETBlur) and then displays the second text field at the same time with the Alpha pattern.

Place two dynamic text fields on the stage, enter the "This is the first text field" text into one of them and "This is the second text field" text into he other and give them instance names of myTextField1 for the first text field and myTextField2 for the second one. Change the anti-alias setting to "Anti-alias for animation", enable the "Render text as HTML" option and embed the characters using the Auto Fill option in the Embed characters dialog box for both text fields. Next, from the Components panel drag the FlashEff2Code component and the FETAlpha and FETBlur patterns into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.text.alpha. FETAlpha;
import com.jumpeye.flashEff2.text.blur. FETBlur;

var showPattern1:FETAlpha = new FETAlpha();
var showPattern2:FETAlpha = new FETAlpha();
var hidePattern:FETBlur = new FETBlur();
var myEffect:FlashEff2Code = new FlashEff2Code();

myEffect.targetVisibility = false;
myEffect.showTransition = showPattern1;
myEffect.hideTransition = hidePattern;
myEffect.useSwapInsteadHide = true;
myEffect.swapType = FlashEff2.SWAP_TYPE_HIDE_AND_SHOW;
myEffect.swapTransitionName = "com. jumpeye.flasheff2.text.alpha.FETAlpha";
myEffect.swapDelay = 0;
myEffect.swapTargetVisibility = false;

this.addChild(myEffect);
myEffect.swapTargetInstanceName = "myTextField2";
myEffect._targetInstanceName = "myTextField1";
swapType String
Yes
The type of the swap transition. Possible values are FlashEff2.SWAP_TYPE_SHOW, FlashEff2.SWAP_TYPE_HIDE and FlashEff2.SWAP_TYPE_HIDE_AND_SHOW.
  • FlashEff2.SWAP_TYPE_SHOW or "show" - leaves the current target in place, without hiding it and executes only a show transition on the next target
  • FlashEff2.SWAP_TYPE_HIDE or "hide" - executes only a hide transition on the current target and the next target is made visible (if it was invisible prior to the operation) without any transition effects
  • FlashEff2.SWAP_TYPE_HIDE_AND_SHOW or "hideAndShow" - executes a hide transition on the current target and a show transition on the next target, using the time interval specified at swapDelay

The default value is hideAndShow.

Example
The next example applies a show transition based on the Alpha pattern (FETAlpha) to a text field called myTextField1 and then swaps the text field with another one called myTextField2. The swap operation hides the first text field using the Blur pattern (FETBlur) and then displays the second text field at the same time with the Alpha pattern.

Place two dynamic text fields on the stage, enter the "This is the first text field" text into one of them and "This is the second text field" text into he other and give them instance names of myTextField1 for the first text field and myTextField2 for the second one. Change the anti-alias setting to "Anti-alias for animation", enable the "Render text as HTML" option and embed the characters using the Auto Fill option in the Embed characters dialog box for both text fields. Next, from the Components panel drag the FlashEff2Code component and the FETAlpha and FETBlur patterns into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.text.alpha. FETAlpha;
import com.jumpeye.flashEff2.text.blur. FETBlur;

var showPattern1:FETAlpha = new FETAlpha();
var showPattern2:FETAlpha = new FETAlpha();
var hidePattern:FETBlur = new FETBlur();
var myEffect:FlashEff2Code = new FlashEff2Code();

myEffect.targetVisibility = false;
myEffect.showTransition = showPattern1;
myEffect.hideTransition = hidePattern;
myEffect.useSwapInsteadHide = true;
myEffect.swapType = FlashEff2.SWAP_TYPE_HIDE_AND_SHOW;
myEffect.swapTransition = showPattern2;
myEffect.swapDelay = 0;
myEffect.swapTargetVisibility = false;

this.addChild(myEffect);
myEffect.swapTargetInstanceName = "myTextField2";
myEffect._targetInstanceName = "myTextField1";
target DisplayObject
No
The reference to the target object. The target can be set using the full path in the time line, if this object and the FlashEff2Code instance do not have the same direct parent (e.g. The FlashEff2Code instance was added to the display list as a child of clip1 and the target object is myClip.container.targetClip). This property must be set after both the target object and the FlashEff2Code component were added to the display list.

Example
The next example applies a show transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.showTransitionName = "com. jumpeye.flasheff2.symbol.alpha.FESAlpha";
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
trace(myEffect.target+" :: "+myEffect.target.name); // [object MovieClip] :: myClip
targetVisibility Boolean
Yes
Specifies whether the target object is visible at the beginning, before applying the show or hide transitions. If true, the target object will be displayed during the time interval specified at showDelay or hideDelay and, after that, the show or hide transition will start. In case of a show transition, the target will be displayed for the amount of time specified by showDelay and then hidden, before the transition starts. This property can also be set from the FlashEff2 panel by selecting the "target is visible" option in the Show or Hide tab.

The default value is true.

Example
The next example applies a show transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip. Before the executing the transition, there is a 3 second delay while the target object is kept invisible because targetVisibility is set to false.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.symbol. alpha.FESAlpha;

var myPattern:FESAlpha = new FESAlpha();
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.showTransition = myPattern;
myEffect.showDelay = 3;
myEffect.targetVisibility = false;
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
textField TextField
No
The reference to the target text field on which the effect is applied. You can directly access the properties and methods of the target text field by accessing this property of the FlashEff2Code component instance.

Example
The next example applies a show transition based on the Alpha pattern (FETAlpha), on a text field called myTextField.

Place a dynamic text field on the stage, enter the "The quick brown fox jumps over the lazy dog" text into it and give it an instance name of myTextField. Change the anti-alias setting to "Anti-alias for animation", enable the "Render text as HTML" option and embed the characters using the Auto Fill option in the Embed characters dialog box. Next, from the Components panel drag the FlashEff2Code component and the FETAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.showTransitionName = "com. jumpeye.flasheff2.text.alpha.FETAlpha";
this.addChild(myEffect);
myEffect._targetInstanceName = "myTextField";
trace(myEffect.target+" :: "+myEffect.target.name);
useHandCursor Boolean
Yes
A Boolean value that indicates whether the pointing hand (hand cursor) appears when the mouse rolls over the target object. If this property is set to true the buttonMode property is set to true automatically and the pointing hand used for buttons appears when the mouse rolls over the target object. If useHandCursor is false, the arrow pointer is used instead. You can change the useHandCursor property any time, either by code or from the FlashEff2 panel itself.

The default value is false.
useSwapInsteadHide Boolean
Yes
A Boolean value which indicates whether a swap transition should be made instead of a hide transition. If true, a swap transition will take place and not the hide transition. This property must always be set to true, if you wan to swap the current target object with another one. The swap transition will apply a hide transition on the current text field if swapType is FlashEff2.SWAP_TYPE_HIDE or FlashEff2.SWAP_TYPE_HIDE_AND_SHOW and perform a show transition on the second text field if swapType is FlashEff2.SWAP_TYPE_SHOW or FlashEff2.SWAP_TYPE_HIDE_AND_SHOW.

The default value is false.

Example
The next example applies a show transition based on the Alpha pattern (FETAlpha) to a text field called myTextField1 and then swaps the text field with another one called myTextField2. The swap operation hides the first text field using the Blur pattern (FETBlur) and then displays the second text field at the same time with the Alpha pattern.

Place two dynamic text fields on the stage, enter the "This is the first text field" text into one of them and "This is the second text field" text into he other and give them instance names of myTextField1 for the first text field and myTextField2 for the second one. Change the anti-alias setting to "Anti-alias for animation", enable the "Render text as HTML" option and embed the characters using the Auto Fill option in the Embed characters dialog box for both text fields. Next, from the Components panel drag the FlashEff2Code component and the FETAlpha and FETBlur patterns into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.text.alpha. FETAlpha;
import com.jumpeye.flashEff2.text.blur. FETBlur;

var showPattern1:FETAlpha = new FETAlpha();
var showPattern2:FETAlpha = new FETAlpha();
var hidePattern:FETBlur = new FETBlur();
var myEffect:FlashEff2Code = new FlashEff2Code();

myEffect.targetVisibility = false;
myEffect.showTransition = showPattern1;
myEffect.hideTransition = hidePattern;
myEffect.useSwapInsteadHide = true;
myEffect.swapType = FlashEff2.SWAP_TYPE_HIDE_AND_SHOW;
myEffect.swapTransition = showPattern2;
myEffect.swapDelay = 0;
myEffect.swapTargetVisibility = false;

this.addChild(myEffect);
myEffect.swapTargetInstanceName = "myTextField2";
myEffect._targetInstanceName = "myTextField1";
xmlPath String
Yes
The path and name of the .xml file used to set up the current FlashEff2Code instance. If such a file is defined and set to the component instance, then when the component initializes, the settings from the .xml file will override any other settings done through the FlashEff2 panel or through ActionScript code (if those were made before setting the xmlPath property).

Example
var myEffect:FlashEff2Code = new FlashEff2Code();
this.addChild(myEffect);
myEffect.xmlPath = "files/config/xml/setup.xml";

4. Methods

Method Description
addCommand Adds a new command pattern to the target object. The new command will be executed on the event specified as argument.

Parameters
command:IFlashEffCommand - The reference to the command pattern created by code.
eventType:String - The event on which the selected command will be executed. Possible values are rollOver, rollOut, press and release.

Returns
IFlashEffCommand - A reference to the newly created command pattern.

Example
This example lists all the commands applied to the target object, in this case, a single navigateToURL command (FECNavigateToURL).

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FECNavigateToURL pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.command. navigateToURL.FECNavigateToURL;

var myPattern:FECNavigateToURL = new FECNavigateToURL();
myPattern.url = "http://www.flasheff.com/";
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.addCommand(myPattern, "release");
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
for(var i:int = 0; i < myEffect.commands.length; i++)
     trace(i+" :: "+myEffect.commands[i]); // 0 :: [object FECNavigateToURL]
addCommandByName Adds a new command pattern to the target object. The new command will be executed on the event specified as argument.

Parameters
commandName:String - The full path of the command pattern class added to the target object.
eventType:String - The event on which the selected command will be executed. Possible values are rollOver, rollOut, press and release.
initObj:Object (default = null) — An object used to initialize the command pattern.

Returns
IFlashEffCommand - A reference to the newly created command pattern.

Example
This example lists all the commands applied to the target object, in this case, a single navigateToURL command (FECNavigateToURL).

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FECNavigateToURL pattern into the Library. Bring up the Actions panel and paste the following code into it:

var myEffect:FlashEff2Code = new FlashEff2Code();
var initObj:Object = new Object();
initObj.url = "http://www.flasheff.com/";
myEffect.addCommandByName("com.jumpeye.flashEff2.command. navigateToURL.FECNavigateToURL", "release", initObj);
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
for(var i:int = 0; i < myEffect.commands.length; i++)
     trace(i+" :: "+myEffect.commands[i]); // 0 :: [object FECNavigateToURL]
addFilter Adds a new filter pattern to target symbol or text field.

Parameters
filter:IFlashEffFilter - The reference to the filter pattern, created separately by code.

Example
This example lists all the filters applied to the target object, in this case, a single reflection filter (FEFReflection).

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FEFReflection pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.filter.reflection. FEFReflection;

var myPattern:FEFReflection = new FEFReflection();
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.addFilter(myPattern);
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
for(var i:int = 0; i < myEffect.filterList.length; i++)
     trace(i+" :: "+myEffect.filterList[i]); // 0 :: [object FEFReflection]
addFilterByName Adds a new Filter pattern to target symbol or text.

Parameters
filterName:String - The full package and class name of the filter that will be applied.
initObject:Object (default = null) - [optional] An object used to set up the new filter.

Returns
IFlashEffFilter - A reference to the newly created filter pattern.

Example
This example lists all the filters applied to the target object, in this case, a single reflection filter (FEFReflection).

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FEFReflection pattern into the Library. Bring up the Actions panel and paste the following code into it:

var myEffect:FlashEff2Code = new FlashEff2Code();
var initObj:Object = new Object();

initObj.reflectionDistance = 0;
myEffect.addFilterByName("com.jumpeye.flashEff2.filter. reflection.FEFReflection", initObj);
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
for(var i:int = 0; i < myEffect.filterList.length; i++)
     trace(i+" :: "+myEffect.filterList[i]); // 0 :: [object FEFReflection]
applyButtonEffect Reapplies the ButtonEffect pattern to the target object, after it has been removed with the removeButtonEffect() method.
buttonPress Manually applies the mouse press state to the target object, without the mouse press action, and dispatches the FLASHEFFEvents.MOUSE_DOWN event. This is useful when the component should visually change the state of the target object but not as a result of mouse interaction.
buttonRelease Manually applies the mouse release state to the target object, without the mouse release action, and dispatches the FLASHEFFEvents.MOUSE_UP event. This is useful when the component should visually change the state of the target object but not as a result of mouse interaction.
buttonRollOut Manually applies the roll out state to the target object, without the mouse moving out of it, and dispatches the FLASHEFFEvents.ROLL_OUT event. This is useful when the component should visually change the state of the target object but not as a result of mouse interaction.
buttonRollOver Manually applies the roll over state to the target object, without the mouse getting over it, and dispatches the FLASHEFFEvents.ROLL_OVER event. This is useful when the component should visually change the state of the target object but not as a result of mouse interaction.
changeTarget Changes the target of the FlashEff2Code instance by applying a hide first on the last visible target, then it shows the newTarget object with the selected show pattern.

The method does suppress autoPlay and will count the delays.

Parameters
newTarget:DisplayObject - The object to be used instead the current target.

Example
myEffect.changeTarget(myNewTarget);
dispatchEvent Dispatches a FLASHEFFEvent type of event.

Parameters
ev:Event - The event object dispatched as parameter. This object has a type which usually is one of the types described in the FLASHEFFEvent class and additional information about the event that is being dispatched.

Returns
Boolean - A value of true if the event was successfully dispatched. A value of false indicates failure or that preventDefault() was called on the event.
getFilter Returns a reference to the filter pattern specified in the argument.

Parameters
filterName:String - The full package and class name of the filter pattern that should be returned.

Returns
IFlashEffFilter - A reference to the desired filter pattern or the value null if it was not found among the filter patterns applied to the target object.

Example
This example adds a filter to a clip (symbol) called myClip and lists the filter by using the appropriate methods.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FEFReflection pattern into the Library. Bring up the Actions panel and paste the following code into it:

var myEffect:FlashEff2Code = new FlashEff2Code();
var initObj:Object = new Object();

initObj.reflectionDistance = 0;
myEffect.addFilterByName("com.jumpeye.flashEff2.filter. reflection.FEFReflection", initObj);
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";

trace(myEffect.getFilter("com.jumpeye.flashEff2.filter. reflection.FEFReflection")); // [object FEFReflection]
trace(myEffect.getFilterAt(0)); // [object FEFReflection]
getFilterAt Returns the filter pattern that exists at the specified index.

Parameters
index:uint — The index which the target filter pattern has in the list of filters applied to the target symbol or text.

Returns
IFlashEffFilter - The filter pattern that is located at the specified index.

Example
This example adds a filter to a clip (symbol) called myClip and lists the filter by using the appropriate methods.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FEFReflection pattern into the Library. Bring up the Actions panel and paste the following code into it:

var myEffect:FlashEff2Code = new FlashEff2Code();
var initObj:Object = new Object();

initObj.reflectionDistance = 0;
myEffect.addFilterByName("com.jumpeye.flashEff2.filter. reflection.FEFReflection", initObj);
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";

trace(myEffect.getFilter("com.jumpeye.flashEff2.filter. reflection.FEFReflection")); // [object FEFReflection]

trace(myEffect.getFilterAt(0)); // [object FEFReflection]
hide Hides the target object using the pattern currently applied to the target object (symbol or text field). If the FlashEff2Code instance does not have a symbol or text pattern applied, it will not execute anything.

Example
The next example applies a hide transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip. The hide transition will not execute automatically since the hideAutoPlay property is set to false, but it will execute on mouse click over the target clip.

Create a movie clip on the stage, give it an instance name of myClip and also place a button on the stage and name it buttonInstance. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.symbol. alpha.FESAlpha;

var myPattern:FESAlpha = new FESAlpha();
var myEffect:FlashEff2Code = new FlashEff2Code();

myEffect.hideTransition = myPattern;
myEffect.hideDelay = 0;
myEffect.hideAutoPlay = false;
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";

buttonInstance.addEventListener(MouseEvent.CLICK, clikHandler);

function clikHandler(evt:MouseEvent):void {
     myEffect.hide();
}
removeAll Removes all the show/hide effects, filters, commands and button effects added through the FlashEff2Code component instance, to the target object (symbol or text field), canceling any functionality provided by them. This method will not remove the FlashEff2Code instance. To remove the FlashEff2Code instance too, you'll need to remove it from the display list.
removeAllCommands Removes all the command patterns applied to the target object.

Example
This example adds the navigateToURL command to a clip, on both, the mouse press and mouse release actions and displays the list of commands. When a button is pressed, the commands are removed.

Create a movie clip on the stage, give it an instance name of myClip and also place a button on the stage and name it buttonInstance. Next, from the Components panel drag the FlashEff2Code component and the FECNavigateToURL pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.command.navigateToURL. FECNavigateToURL;

var myPattern1:FECNavigateToURL = new FECNavigateToURL();
myPattern1.url = "http://www.flasheff.com/";
var myPattern2:FECNavigateToURL = new FECNavigateToURL();
myPattern2.url = "http://www.jumpeyecomponents.com/";
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.addCommand(myPattern1, "press");
myEffect.addCommand(myPattern2, "release");
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";

trace(myEffect.commands.length+" commands applied to the target object");
for(var i:int = 0; i < myEffect.commands.length; i++)
     trace(i+" :: "+myEffect.commands[i]);

/* output:
2 commands applied to the target object
0 :: [object FECNavigateToURL]
1 :: [object FECNavigateToURL]
*/

buttonInstance.addEventListener(MouseEvent.CLICK, clikHandler);
function clikHandler(evt:MouseEvent):void {
     myEffect.removeAllCommands();
     trace(myEffect.commands.length+" commands applied to the target object");

     for(var i:int = 0; i < myEffect.commands.length; i++)
          trace(i+" :: "+myEffect.commands[i]);

/* output:
0 commands applied to the target object
*/
}
removeAllCommandsBy EventType Removes all the command patterns from the target object, that are executed on a specified event.

Parameters eventType:String - The type of event for which all the command patterns will be removed. Possible values are rollOver, rollOut, press and release.

Example
This example adds the navigateToURL command to a clip, on both the mouse press and mouse release actions and displays the list of commands. When a button is pressed, the command added for the mouse press event is removed.

Create a movie clip on the stage, give it an instance name of myClip and also place a button on the stage and name it buttonInstance. Next, from the Components panel drag the FlashEff2Code component and the FECNavigateToURL pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.command.navigateToURL. FECNavigateToURL;

var myPattern1:FECNavigateToURL = new FECNavigateToURL();
myPattern1.url = "http://www.flasheff.com/";
var myPattern2:FECNavigateToURL = new FECNavigateToURL();
myPattern2.url = "http://www.jumpeyecomponents.com/";
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.addCommand(myPattern1, "press");
myEffect.addCommand(myPattern2, "release");
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";

trace(myEffect.commands.length+" commands applied to the target object");
for(var i:int = 0; i < myEffect.commands.length; i++)
trace(i+" :: "+myEffect.commands[i]);

/* output:
2 commands applied to the target object
0 :: [object FECNavigateToURL]
1 :: [object FECNavigateToURL]
*/

buttonInstance.addEventListener(MouseEvent.CLICK, clikHandler);

function clikHandler(evt:MouseEvent):void {
myEffect.removeAllCommandsByEventType("press");
trace(myEffect.commands.length+" commands applied to the target object");

for(var i:int = 0; i < myEffect.commands.length; i++)
trace(i+" :: "+myEffect.commands[i]);

/* output:
1 commands applied to the target object
0 :: [object FECNavigateToURL]
*/
}
removeAllFilters Removes all the filter patterns applied on the current FlashEff2Code component instance, visually removing them from the target symbol or text, but leaving all the other types of patterns.
removeButtonEffect Removes the current ButtonEffect pattern applied to the target object.
removeCommand Removes the specified command pattern instance from the target object.

Parameters
command:IFlashEffCommand - The pattern instance that should be removed.

Example
This example adds a navigateToURL and a goToFrame command to a clip, on the mouse press action and displays the list of commands. When a button is pressed, the goToFrame command is removed.

Create a movie clip on the stage, give it an instance name of myClip and also place a button on the stage and name it buttonInstance. Next, from the Components panel drag the FlashEff2Code component, the FECNavigateToURL and the FECGoToFrame patterns into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.command.navigateToURL. FECNavigateToURL;
import com.jumpeye.flashEff2.command.goToFrame. FECGoToFrame;

var myPattern1:FECNavigateToURL = new FECNavigateToURL();
myPattern1.url = "http://www.flasheff.com/";
var myPattern2:FECGoToFrame = new FECGoToFrame();
myPattern2.frame = "10";
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.addCommand(myPattern1, "release");
myEffect.addCommand(myPattern2, "release");
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";

trace(myEffect.commands.length+" commands applied to the target object");
for(var i:int = 0; i < myEffect.commands.length; i++)
     trace(i+" :: "+myEffect.commands[i]);

/* output:
2 commands applied to the target object
0 :: [object FECNavigateToURL]
1 :: [object FECGoToFrame]
*/

buttonInstance.addEventListener(MouseEvent.CLICK, clikHandler);

function clikHandler(evt:MouseEvent):void {
     myEffect.removeCommand(myPattern2);
     trace(myEffect.commands.length+" commands applied to the target object");

     for(var i:int = 0; i < myEffect.commands.length; i++)
          trace(i+" :: "+myEffect.commands[i]);

/* output:
1 commands applied to the target object
0 :: [object FECNavigateToURL]
*/
}
removeCommandBy Name Removes from the target object the command pattern identified by its full path and class name.

Parameters
commandName:String - The full path and class name of the command pattern to be removed.

Example
This example adds a navigateToURL and a goToFrame command to a clip, on the mouse press action and displays the list of commands. When a button is pressed, the goToFrame command is removed.

Create a movie clip on the stage, give it an instance name of myClip and also place a button on the stage and name it buttonInstance. Next, from the Components panel drag the FlashEff2Code component, the FECNavigateToURL and the FECGoToFrame patterns into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.command.navigateToURL. FECNavigateToURL;
import com.jumpeye.flashEff2.command.goToFrame. FECGoToFrame;

var myPattern1:FECNavigateToURL = new FECNavigateToURL();
myPattern1.url = "http://www.flasheff.com/";
var myPattern2:FECGoToFrame = new FECGoToFrame();
myPattern2.frame = "10";
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.addCommand(myPattern1, "release");
myEffect.addCommand(myPattern2, "release");
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";

trace(myEffect.commands.length+" commands applied to the target object");
for(var i:int = 0; i < myEffect.commands.length; i++)
     trace(i+" :: "+myEffect.commands[i]);

/* output:
2 commands applied to the target object
0 :: [object FECNavigateToURL]
1 :: [object FECGoToFrame]
*/

buttonInstance.addEventListener(MouseEvent.CLICK, clikHandler);

function clikHandler(evt:MouseEvent):void {
     myEffect.removeCommandByName("com. jumpeye.flasheff2.command.goToFrame.FECGoToFrame");
     trace(myEffect.commands.length+" commands applied to the target object");

     for(var i:int = 0; i < myEffect.commands.length; i++)
          trace(i+" :: "+myEffect.commands[i]);

/* output:
1 commands applied to the target object
0 :: [object FECNavigateToURL]
*/
}
removeEffect Stops and removes an effect applied to the target object, while that effect is still playing. This function will not have any effect if it's applied before the effect starts or after the effect has finished (except when isTargetVisibleAtEnd is set to true and the transition type was hide). Depending on the value of the internalCall argument, it can trigger a FLASHEFFEvents.TRANSITION_END event or not. If the method was called from within an internal class or a pattern object, this parameter should be true and the event will not trigger. If the method was called from outside the FlashEff2 class or outside the patterns, then the parameter's value should be false (the default value) and the FLASHEFFEvents.TRANSITION_END event will be triggered.

This also has the possibility to remove a specific symbol or text pattern from the target object, by specifying a second argument. If that pattern argument is not specified, the method removes the current symbol or text pattern that is being applied (while the transition is going on).

In the case of a hide transition, either on a symbol or a text object, the target object will be rendered invisible in the end, by the transition. If removeEffect() is called after the transition has finished, the target object will be displayed only if the isTargetVisibleAtEnd is set to true, otherwise the target object will remain hidden (the method has no effect).

Parameters
internalCall:Boolean (default = false) — [optional] Instructs the method to dispatch a FLASHEFFEvents.TRANSITION_END event, if the value is false, that is if the method is not called from inside a pattern object.
pattern:IFlashEffSymbolText (default = null) — The symbol or text pattern that should be removed from the list of patterns applied to the target object. That type of pattern is a show/hide pattern, meaning that it can only apply show or hide transitions on symbols or text fields.

Example
The next example applies a hide transition based on the Alpha pattern (FETAlpha), on a text field called myTextField. The hide transition will be executed automatically, with a delay of a second. By pressing the button on the stage, the removeEffect() method will be called. In both cases (button pressed during and after the transition), a FLASHEFFEvents.TRANSITION_END event will be dispatched.

Place a dynamic text field on the stage, enter the text "The quick brown fox jumps over the lazy dog" into it and give it an instance name of myTextField. Set the anti-alias setting to "Anti-alias for animation", enable the "Render text as HTML" option and embed the characters using the Auto Fill option in the Embed characters dialog box. Also place a Button on the stage and give it an instance name of buttonInstance. Next, from the Components panel drag the FlashEff2Code component and the FETAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.text.alpha.FETAlpha;
import com.jumpeye.Events.FLASHEFFEvents;

var myPattern:FETAlpha = new FETAlpha();
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.hideTransition = myPattern;
myEffect.hideDelay = 1;
myEffect.isTargetVisibleAtEnd = true;
this.addChild(myEffect);
myEffect._targetInstanceName = "myTextField";

buttonInstance.addEventListener(MouseEvent.CLICK, clikHandler);

function clikHandler(evt:MouseEvent):void {
     myEffect.removeEffect();
}

myEffect.addEventListener(FLASHEFFEvents.TRANSITION_END, transitionEndHandler);

function transitionEndHandler(evtObj:FLASHEFFEvents):void {
     trace("The transition has ended.");
}
removeFilter Removes a specified filter from the target symbol or text. It returns a Boolean value (true) if it’s successful.

Parameters
filter:IFlashEffFilter - The reference to the filter pattern created separately, by code.
removeHideTransition Removes the last symbol or text pattern used for the hide transition.
removeShowTransition Removes the last symbol or text pattern used for the show transition.
setXML Allows setting up the component according to xml data passed as parameter.

Parameters
xml:* - The XML object that contains setup information for the FlashEff2Code component instance. It can be either of type XML, a XML object created by code, or of type String, the same xml data passed as String argument.
show Applies a show transition to the target object, if a symbol or text pattern has been applied to it. If the FlashEff2 object does not have a symbol or text pattern applied, it will not execute any actions.

Parameters
forceAutoHide:* (default = null) — [optional] If true, the show method will execute a show transition and then, force FlashEff2 to execute a hide transition after the time interval specified at hideDelay, even if hideAutoPlay is set to false. Otherwise, only the show transition will be executed.

Example
The next example applies a show transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip. The show transition will not execute automatically since the showAutoPlay property is set to false, but it will execute on mouse click over the target clip.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.symbol.alpha.FESAlpha;

var myPattern:FESAlpha = new FESAlpha();
var myEffect:FlashEff2Code = new FlashEff2Code();

myEffect.showTransition = myPattern;
myEffect.showDelay = 0;
myEffect.showAutoPlay = false;
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";

myClip.addEventListener(MouseEvent.CLICK, clikHandler);

function clikHandler(evt:MouseEvent):void {
     myEffect.show();
}
swap Applies the swap transition between two target objects. The first target object is the one that is currently visible and will be hidden with a hide transition if swapType is FlashEff2.SWAP_TYPE_HIDE or FlashEff2.SWAP_TYPE_HIDE_AND_SHOW. The second target object is the one that will be made visible after the transition, using a show transition, if swapType is FlashEff2.SWAP_TYPE_SHOW or FlashEff2.SWAP_TYPE_HIDE_AND_SHOW.

Parameters
newTarget:DisplayObject (default = null) - The second target object that will replace the current target object. If this is null, then the object specified at swapTarget will be used.
swType:String (default = "") - The type of swap transition applied. If it is a blank String (""), then the transition type will be the one specified at swapType.

Example
The next example uses the swap() method to apply a swap transition between two text fields, by pressing on a button. The example applies a show transition based on the Alpha pattern (FETAlpha) to a text field called myTextField1 and then swaps the text field with another one called myTextField2. The swap operation hides the first text field using the Blur pattern (FETBlur) and then displays the second text field at the same time with the Alpha pattern.

Place two dynamic text fields on the stage, enter the "This is the first text field" text into one of them and "This is the second text field" text into he other and give them instance names of myTextField1 for the first text field and myTextField2 for the second one. Change the anti-alias setting to "Anti-alias for animation", enable the "Render text as HTML" option and embed the characters using the Auto Fill option in the Embed characters dialog box for both text fields. Next, place a button on the Stage and give it the instance name of swapButton. Finally, from the Components panel drag the FlashEff2Code component and the FETAlpha and FETBlur patterns into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.text.alpha.FETAlpha;
import com.jumpeye.flashEff2.text.blur.FETBlur;

myTextField2.visible = false;

var showPattern1:FETAlpha = new FETAlpha();
var showPattern2:FETAlpha = new FETAlpha();
var hidePattern:FETBlur = new FETBlur();
var myEffect:FlashEff2Code = new FlashEff2Code();

myEffect.targetVisibility = false;
myEffect.showTransition = showPattern1;
myEffect.hideTransition = hidePattern;

this.addChild(myEffect);
myEffect.swapTargetInstanceName = "myTextField2";
myEffect._targetInstanceName = "myTextField1";

this.addChild(myEffect);
myEffect._targetInstanceName = "myTextField1";
swapButton.addEventListener(MouseEvent.CLICK, makeSwap);

function makeSwap(evtObj:MouseEvent):void {
     myEffect.swap(myTextField2, FlashEff2.SWAP_TYPE_HIDE_AND_SHOW);
}
transitionEffect Starts a show or hide effect, according to the argument's value.

Parameters
type:String (default = "show") — The type of transition to be executed. Possible values are show and hide.

Example
The next example applies a show transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip. The show transition will not execute automatically since the showAutoPlay property is set to false, but it will execute on mouse click over the target clip.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.symbol.alpha.FESAlpha;

var myPattern:FESAlpha = new FESAlpha();
var myEffect:FlashEff2Code = new FlashEff2Code();

myEffect.showTransition = myPattern;
myEffect.showDelay = 0;
myEffect.showAutoPlay = false;
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";
myClip.addEventListener(MouseEvent.CLICK, clikHandler);

function clikHandler(evt:MouseEvent):void {
     myEffect.transitionEffect("show");
}

5. Events

Event Description
IOErrorEvent.IO_ERROR Dispatched when the FlashEff2Code component instance encounters an error while the .xml setup file is being loaded.

Example
This example sets up the FlashEff2Code component instance from an external .xml file and displays an error message if the .xml file cannot be read.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import flash.events.IOErrorEvent;
import com.jumpeye.Events.FLASHEFFEvents;

var myEffect:FlashEff2Code = new FlashEff2Code();
this.addChild(myEffect);
myEffect.xmlPath = "setup.xml";
myEffect.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
myEffect.addEventListener(FLASHEFFEvents.COMPLETE, completeHandler);

function errorHandler(evtObj:IOErrorEvent):void {
     trace("Could not read the XML data !");
}

function completeHandler(evtObj:FLASHEFFEvents):void {
     trace("XML data loaded completely");
     trace(evtObj.data);
}
FLASHEFFEvents.COMPLETE Dispatched when the FlashEff2Code component instance is set up from a .xml file and the file has been completely loaded. The event object passed as an argument to the event handler function has a property called data that gives you access to the XML object used to set up the component instance. This event is dispatched before the FLASHEFFEvents.INIT event.

Example
This example sets up the FlashEff2Code component instance from an external .xml file and displays a text when the component finished reading the .xml file.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import flash.events.IOErrorEvent;
import com.jumpeye.Events.FLASHEFFEvents;

var myEffect:FlashEff2Code = new FlashEff2Code();
this.addChild(myEffect);
myEffect.xmlPath = "setup.xml";
myEffect.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
myEffect.addEventListener(FLASHEFFEvents.COMPLETE, completeHandler);

function errorHandler(evtObj:IOErrorEvent):void {
     trace("Could not read the XML data !");
}

function completeHandler(evtObj:FLASHEFFEvents):void {
     trace("XML data loaded completely");
     trace(evtObj.data);
}
FLASHEFFEvents.INIT Dispatched when the FlashEff2Code component completes the initialization process. This event is dispatched after the FLASHEFFEvents.COMPLETE event.

Example
This example sets up the FlashEff2Code component instance from an external .xml file and displays a traced message when the component finished initializing.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.Events.FLASHEFFEvents;

var myEffect:FlashEff2Code = new FlashEff2Code();
this.addChild(myEffect);
myEffect.xmlPath = "setup.xml";
myEffect.addEventListener(FLASHEFFEvents.INIT, initHandler);

function initHandler(evtObj:FLASHEFFEvents):void {
     trace(evtObj.target+" finished initializing.");
}
FLASHEFFEvents.DOUBLE_CLICK Dispatched by the FlashEff2Code component when the target object has been clicked twice (double click action).

Example
The next example applies a show transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip. The show transition will be executed with a 2 second delay and the FlashEff2Code component instance will dispatch the mouse events executed on the target clip.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.Events.FLASHEFFEvents;
import com.jumpeye.flashEff2.symbol.alpha.FESAlpha;

var myPattern:FESAlpha = new FESAlpha();
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.showTransition = myPattern;
myEffect.showDelay = 2;
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";

myEffect.addEventListener(FLASHEFFEvents. DOUBLE_CLICK, dblClickHandler);

function dblClickHandler(evtObj:FLASHEFFEvents):void {
     trace("DOUBLE CLICK on target object");
}
FLASHEFFEvents.MOUSE_DOWN Dispatched by the FlashEff2Code component when a mouse button has been pressed on the target object.

Example
The next example applies a show transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip. The show transition will be executed with a 2 second delay and the FlashEff2Code component instance will dispatch the mouse events executed on the target clip.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.Events.FLASHEFFEvents;
import com.jumpeye.flashEff2.symbol.alpha.FESAlpha;

var myPattern:FESAlpha = new FESAlpha();
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.showTransition = myPattern;
myEffect.showDelay = 2;
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";

myEffect.addEventListener(FLASHEFFEvents. MOUSE_DOWN, mouseDownHandler);
myEffect.addEventListener(FLASHEFFEvents.MOUSE_UP, mouseUpHandler);

function mouseDownHandler(evtObj:FLASHEFFEvents):void {
     trace("MOUSE DOWN on target object");
}

function mouseUpHandler(evtObj:FLASHEFFEvents):void {
     trace("MOUSE UP on target object");
}
FLASHEFFEvents.MOUSE_UP Dispatched by the FlashEff2Code component when a mouse button has been released over the target object, regardless of whether the mouse down action has happened to the target object or on another DisplayObject.

Example
The next example applies a show transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip. The show transition will be executed with a 2 second delay and the FlashEff2Code component instance will dispatch the mouse events executed on the target clip.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.Events.FLASHEFFEvents;
import com.jumpeye.flashEff2.symbol.alpha.FESAlpha;

var myPattern:FESAlpha = new FESAlpha();
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.showTransition = myPattern;
myEffect.showDelay = 2;
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";

myEffect.addEventListener(FLASHEFFEvents. MOUSE_DOWN, mouseDownHandler);
myEffect.addEventListener(FLASHEFFEvents.MOUSE_UP, mouseUpHandler);

function mouseDownHandler(evtObj:FLASHEFFEvents):void {
     trace("MOUSE DOWN on target object");
}

function mouseUpHandler(evtObj:FLASHEFFEvents):void {
     trace("MOUSE UP on target object");
}
FLASHEFFEvents.ROLL_OVER Dispatched by the FlashEff2Code component when the mouse rolls over the target object's surface.

Example
The next example applies a show transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip. The show transition will be executed with a 2 second delay and the FlashEff2Code component instance will dispatch the mouse events executed on the target clip.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.Events.FLASHEFFEvents;
import com.jumpeye.flashEff2.symbol.alpha.FESAlpha;

var myPattern:FESAlpha = new FESAlpha();
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.showTransition = myPattern;
myEffect.showDelay = 2;
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";

myEffect.addEventListener(FLASHEFFEvents.ROLL_OVER, rollOverHandler);
myEffect.addEventListener(FLASHEFFEvents.ROLL_OUT, rollOutHandler);

function rollOverHandler(evtObj:FLASHEFFEvents):void {
     trace("ROLL OVER on target object");
}

function rollOutHandler(evtObj:FLASHEFFEvents):void {
     trace("ROLL OUT on target object");
}
FLASHEFFEvents.ROLL_OUT Dispatched by the FlashEff2Code component when the mouse rolls out of the target object's surface.

Example
The next example applies a show transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip. The show transition will be executed with a 2 second delay and the FlashEff2Code component instance will dispatch the mouse events executed on the target clip.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.Events.FLASHEFFEvents;
import com.jumpeye.flashEff2.symbol.alpha.FESAlpha;

var myPattern:FESAlpha = new FESAlpha();
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.showTransition = myPattern;
myEffect.showDelay = 2;
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";

myEffect.addEventListener(FLASHEFFEvents.ROLL_OVER, rollOverHandler);
myEffect.addEventListener(FLASHEFFEvents.ROLL_OUT, rollOutHandler);

function rollOverHandler(evtObj:FLASHEFFEvents):void {
     trace("ROLL OVER on target object");
}

function rollOutHandler(evtObj:FLASHEFFEvents):void {
     trace("ROLL OUT on target object");
}
FLASHEFFEvents.TRANSITION_ END Dispatched by the FlashEff2Code component when the transition of a symbol or text pattern has ended.

Example
The next example applies a show transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip. The FlashEff2Code component instance will dispatch events when the transition starts and when it ends.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FESAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.symbol.alpha.FESAlpha;
import com.jumpeye.Events.FLASHEFFEvents;

var myPattern:FESAlpha = new FESAlpha();
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.showTransition = myPattern;
this.addChild(myEffect);
myEffect._targetInstanceName = "myClip";

myEffect.addEventListener(FLASHEFFEvents. TRANSITION_START, transitionStartHandler);
myEffect.addEventListener(FLASHEFFEvents. TRANSITION_END, transitionEndHandler);

function transitionStartHandler(evtObj:FLASHEFFEvents):void {
     trace("The transition has started.");
}

function transitionEndHandler(evtObj:FLASHEFFEvents):void {
     trace("The transition has ended.");
}
FLASHEFFEvents.TRANSITION_ START Dispatched by the FlashEff2Code component when the transition of a symbol or text pattern has started.

Example
The next example applies a show transition based on the Alpha pattern (FESAlpha), to a clip (symbol) called myClip. The FlashEff2Code component instance will dispatch events when the transition starts and when it ends.

Create a movie clip on the stage and give it an instance name of myClip. Next, from the Components panel drag the FlashEff2Code component and the FETAlpha pattern into the Library. Bring up the Actions panel and paste the following code into it:

import com.jumpeye.flashEff2.text.alpha.FETAlpha;
import com.jumpeye.Events.FLASHEFFEvents;

var myPattern:FETAlpha = new FETAlpha();
var myEffect:FlashEff2Code = new FlashEff2Code();
myEffect.showTransition = myPattern;
this.addChild(myEffect);
myEffect._targetInstanceName = "myTextField";

myEffect.addEventListener(FLASHEFFEvents. TRANSITION_START, transitionStartHandler);
myEffect.addEventListener(FLASHEFFEvents. TRANSITION_END, transitionEndHandler);

function transitionStartHandler(evtObj:FLASHEFFEvents):void {
     trace("The transition has started.");
}

function transitionEndHandler(evtObj:FLASHEFFEvents):void {
     trace("The transition has ended.");
}