////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package mx.effects
{
import flash.events.Event;
import flash.events.IEventDispatcher;
/**
* The IEffect interface defines the base
* interface of all Flex effects.
* The IEffectInstance interface defines the base interface for all effect
* instance subclasses.
*
* @see mx.effects.IEffectInstance
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public interface IEffect extends IAbstractEffect
{
//--------------------------------------------------------------------------
//
// Properties
//
//--------------------------------------------------------------------------
//----------------------------------
// className
//----------------------------------
/**
* The name of the effect class, such as "Fade"
.
*
*
This is a short, or unqualified, class name
* that does not include the package name.
* If you need the qualified name, use the
* getQualifiedClassName()
method
* in the flash.utils package.
Target filtering is only performed if you call the
* captureStartValues()
method before playing the effect.
* Flex automatically calls the captureStartValues()
method
* when the effect is part of a transition.
Use the filter
property for simple filtering.
* If the customFilter
property is non-null,
* the filter
property is ignored.
In a Parallel or Sequence effect, the duration
* property sets the duration of each effect.
* For example, if a Sequence effect has its duration
* property set to 3000, each effect in the Sequence takes 3000 ms
* to play.
For a repeated effect, the duration
property
* specifies the duration of a single instance of the effect.
* Therefore, if an effect has a duration
property
* set to 2000, and a repeatCount
property set to 3,
* the effect takes a total of 6000 ms (6 seconds) to play.
null
specifies no filtering.
*
* Target filtering is only performed if you call the
* captureStartValues()
method before playing the effect.
* Flex automatically calls the captureStartValues()
method
* when the effect is part of a transition, or part of a data effect
* for a list-based control.
Use this property for simple filtering.
* Use the customFilter
property for more complex filtering.
* If the customFilter
property has a non-null value,
* this property is ignored.
You can use the following values for the filter
* property:
"add"
plays the effect on any targets
* that are added as a child to a container."addItem"
plays the effect
* on the item renderer for any list items added to a List
* or TileList control."hide"
plays the effect on any targets
* whose visible property changed from true
to
* false
."move"
plays the effect on any targets
* that changed their x
or y
* properties."remove"
plays the effect on any targets
* that are removed as a child of a container."removeItem"
plays the effect
* on the item renderer for any list items removed from a List
* or TileList control."replacedItem"
plays the effect
* on the item renderer for any list items replaced in a List
* or TileList control by a new item."replacementItem"
plays the effect
* on the item renderer for any list items added to a List
* or TileList control that replaces an existing item."resize"
plays the effect
* on any targets that changed their width
* or height
properties."show"
plays the effect
* on any targets whose visible property changed
* from false
to true
.""
specifies no filtering.Set this property to true
* to hide the focus ring during the effect.
For subclasses of Effect, the default value is false
.
* For subclasses of MaskEffect, the default value is true
.
*
startDelay
property.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function get perElementOffset():Number;
/**
* @private
*/
function set perElementOffset(value:Number):void;
//----------------------------------
// relevantProperties
//----------------------------------
/**
* An Array of property names to use when performing filtering.
* This property is used internally and should not be set by
* effect users.
*
* The default value is equal to the Array returned by
* the getAffectedProperties()
method.
The default value is equal to the Array returned by
* the getAffectedProperties()
method.
target
property is automatically set to be
* the object that triggers the effect.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function get target():Object;
/**
* @private
*/
function set target(value:Object):void;
//----------------------------------
// targets
//----------------------------------
/**
* An Array of objects that are targets for the effect.
* When the effect is playing, it performs the effect on each target
* in parallel.
* Setting the target
property replaces all objects
* in this Array.
* When the targets
property is set, the target
* property returns the first item in this Array.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function get targets():Array;
/**
* @private
*/
function set targets(value:Array):void;
//----------------------------------
// triggerEvent
//----------------------------------
/**
* 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.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function get triggerEvent():Event;
/**
* @private
*/
function set triggerEvent(value:Event):void;
//----------------------------------
// playheadTime
//----------------------------------
/**
* Current time position of the effect.
* This property has a value between 0 and the total duration,
* which includes the Effect's startDelay
,
* repeatCount
, and repeatDelay
.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function get playheadTime():Number;
/**
* @private
*/
function set playheadTime(value:Number):void;
//--------------------------------------------------------------------------
//
// Methods
//
//--------------------------------------------------------------------------
/**
* Returns an Array of Strings, where each String is the name
* of a property changed by this effect.
* For example, the Move effect returns an Array that contains
* "x"
and "y"
.
*
* Every subclass of Effect must implement this method. * The EffectManager uses this method * to ensure that no two effects are trying to animate * the same property of the same object at the same time.
* * @return An Array of Strings specifying the names of the * properties modified by this effect. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ function getAffectedProperties():Array /* of String */; /** * Takes an Array of target objects and invokes the *createInstance()
method on each target.
*
* @param targets Array of objects to animate with this effect.
*
* @return Array of effect instance objects, one per target,
* for the effect.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function createInstances(targets:Array = null):Array /* of EffectInstance */;
/**
* Creates a single effect instance and initializes it.
* Use this method instead of the play()
method
* to manipulate the effect instance properties
* before the effect instance plays.
*
* The effect instance is created with the type
* specified in the instanceClass
property.
* It is then initialized using the initInstance()
method.
* If the instance was created by the EffectManager
* (when the effect is triggered by an effect trigger),
* the effect is further initialized by a call to the
* EffectInstance.initEffect()
method.
Calling the createInstance()
method
* does not play the effect.
* Call the startEffect()
method
* on the returned effect instance.
This function is automatically called by the
* Effect.play()
method.
end()
method
* before you call the play()
method
* to ensure that any previous instance of the effect
* has ended before you start a new one.
*
* All subclasses must implement this method.
* * @param targets Array of target objects on which to play this effect. * If this parameter is specified, then the effect'stargets
* property is not used.
*
* @param playReversedFromEnd If true
,
* play the effect backwards.
*
* @return Array of EffectInstance objects, one per target,
* for the effect.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function play(targets:Array = null,
playReversedFromEnd:Boolean = false):
Array /* of EffectInstance */;
/**
* Pauses the effect until you call the resume()
method.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function pause():void;
/**
* Stops the effect, leaving the effect targets in their current state.
* Unlike a call to the pause()
method,
* you cannot call the resume()
method after calling
* the stop()
method.
* However, you can call the play()
method to restart the effect.
*
* The effect instance dispatches an effectEnd
event
* when you call this method as part of ending the effect.
For mask effects, the mask is not removed automatically * when the effect is stopped. * Running further mask effects on the same target(s) * without first removing the mask can produce unexpected results.
* * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ function stop():void; /** * Resumes the effect after it has been paused * by a call to thepause()
method.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function resume():void;
/**
* Plays the effect in reverse, if the effect is currently playing,
* starting from the current position of the effect.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function reverse():void;
/**
* Interrupts an effect that is currently playing,
* and jumps immediately to the end of the effect.
* Calling this method invokes the EffectInstance.end()
* method.
*
* The effect instance dispatches an effectEnd
event
* when you call this method as part of ending the effect.
If you pass an effect instance as an argument, * just that instance is interrupted. * If no argument is passed in, all effect instances currently * spawned from the effect are interrupted.
* * @param effectInstance EffectInstance to terminate. * * @see mx.effects.EffectInstance#end() * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ function end(effectInstance:IEffectInstance = null):void; /** * Captures the current values of the relevant properties * on the effect's targets. * Flex automatically calls thecaptureStartValues()
* method when the effect is part of a transition.
*
* Use this function when you want the effect to figure out the start * and end values of the effect. * The proper usage of this function is to use it * in the following steps:
* *captureStartValues()
method.
* The effect captures the starting effect values.play()
method.
* The effect captures the end values.
* This function populates the
* EffectInstance.propertyChanges
property
* for each effect instance created by this effect.
* Effect developers can use the propertyChanges
property
* to retrieve the start and end values for their effect.Flex uses this function when a data change * effect is run.
* * @param targets Array of targets for which values are captured * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ function captureMoreStartValues(targets:Array):void; /** * Captures the current values of the relevant properties * on the effect's targets and saves them as end values. * *Flex automatically calls the captureEndValues()
method
* when the effect is part of a data change effect.