Flex - Effect

Advertisements


Introduction

The Effect class is an abstract base class that defines the basic functionality of all Flex effects. The Effect class defines the base factory class for all effects. The EffectInstance class defines the base class for all effect instance subclasses.

Class declaration

Following is the declaration for mx.effects.Effect class:

public class Effect
   extends EventDispatcher
      implements IEffect

Public properties

S.N.Property & Description
1className : String
[read-only] The name of the effect class, such as "Fade".
2customFilter : mx.effects:EffectTargetFilter
Specifies a custom filter object, of type EffectTargetFilter, used by the effect to determine the targets on which to play the effect.
3duration : Number
Duration of the effect in milliseconds.
4effectTargetHost : mx.effects:IEffectTargetHost
A property that lets you access the target list-based control of a data effect.
5filter : String
Specifies an algorithm for filtering targets for an effect.
6hideFocusRing : Boolean
Determines whether the effect should hide the focus ring when starting the effect.
7instanceClass : Class
An object of type Class that specifies the effect instance class class for this effect class.
8isPlaying : Boolean
[read-only] A read-only flag which is true if any instances of the effect are currently playing, and false if none are.
9perElementOffset : Number
Additional delay, in milliseconds, for effect targets after the first target of the effect.
10playheadTime : Number
Current time position of the effect.
11relevantProperties : Array
An Array of property names to use when performing filtering.
12relevantStyles : Array
An Array of style names to use when performing filtering.
13repeatCount : int = 1
Number of times to repeat the effect.
14repeatDelay : int = 0
Amount of time, in milliseconds, to wait before repeating the effect.
15startDelay : int = 0
Amount of time, in milliseconds, to wait before starting the effect.
16suspendBackgroundProcessing : Boolean = false
If true, blocks all background processing while the effect is playing.
17target : Object
The object to which this effect is applied.
18targets : Array
An Array of objects that are targets for the effect.
19triggerEvent : Event
The Event object passed to this Effect by the EffectManager when an effect is triggered, or null if the effect is not being played by the EffectManager.

Protected properties

S.N.Property & Description
1applyTransitionEndProperties : Boolean
This flag controls whether the effect, when run in a transition, automatically applies the property values according to the end state, as opposed to leaving values as set by the effect itself.
2endValuesCaptured : Boolean = false
A flag containing true if the end values of an effect have already been determined, or false if they should be acquired from the current properties of the effect targets when the effect runs.

Public methods

S.N.Method & Description
1Effect(target:Object = null)
Constructor.
2captureEndValues():void
Captures the current values of the relevant properties on the effect's targets and saves them as end values.
3captureMoreStartValues(targets:Array):void
Captures the current values of the relevant properties of an additional set of targets Flex uses this function when a data change effect is run.
4captureStartValues():void
Captures the current values of the relevant properties on the effect's targets.
5createInstance(target:Object = null):IEffectInstance
Creates a single effect instance and initializes it.
6createInstances(targets:Array = null):Array
Takes an Array of target objects and invokes the createInstance() method on each target.
7deleteInstance(instance:IEffectInstance):void
Removes event listeners from an instance and removes it from the list of instances.
8end(effectInstance:IEffectInstance = null):void
Interrupts an effect that is currently playing, and jumps immediately to the end of the effect.
9getAffectedProperties():Array
Returns an Array of Strings, where each String is the name of a property changed by this effect.
10pause():void
Pauses the effect until you call the resume() method.
11play(targets:Array = null, playReversedFromEnd:Boolean = false):Array
Begins playing the effect.
12resume():void
Resumes the effect after it has been paused by a call to the pause() method.
13reverse():void
Plays the effect in reverse, if the effect is currently playing, starting from the current position of the effect.
14stop():void
Stops the effect, leaving the effect targets in their current state.

Protected methods

S.N.Method & Description
1applyValueToTarget(target:Object, property:String, value:*, props:Object):void
Used internally by the Effect infrastructure.
2effectEndHandler(event:EffectEvent):void
Called when an effect instance has finished playing.
3effectStartHandler(event:EffectEvent):void
This method is called when the effect instance starts playing.
4effectStopHandler(event:EffectEvent):void
Called when an effect instance has stopped by a call to the stop() method.
5filterInstance(propChanges:Array, target:Object):Boolean
Determines the logic for filtering out an effect instance.
6getValueFromTarget(target:Object, property:String):*
Called by the captureStartValues() method to get the value of a property from the target.
7initInstance(instance:IEffectInstance):void
Copies properties of the effect to the effect instance.

Events

S.N.Event & Description
1effectEnd
Dispatched when one of the effect's instances finishes playing, either when the instance finishes playing or when the effect is interrupted by a call to the end() method.
2effectStart
Dispatched when the effect starts playing.
3effectStop
Dispatched when the effect has been stopped, which only occurs when the effect is interrupted by a call to the stop() method.

Methods inherited

This class inherits methods from the following classes:

  • flash.events.EventDispatcher

  • Object



Advertisements
Advertisements