Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 236

Creating and extending flex 2 components
Hide thumbs Also See for FLEX 2 - CREATING AND EXTENDING COMPONENTS:
Table of Contents

Advertisement

Notice that the
getAffectedProperties()
because
getAffectedProperties()
modified by the effect, not the properties of the effect itself.
In your instance class, you define a property named soundMP3, corresponding to the
property with the same name in the factory class. Then, use it to create the URLRequest
object to play the sound, as the following example shows:
package myEffects
{
// MySoundParamInstance.as
import mx.effects.EffectInstance;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
public class MySoundParamInstance extends EffectInstance
{
// Define local variables.
private var s:Sound;
private var sndChannel:SoundChannel;
private var u:URLRequest;
// Define a variable for the MP3 URL.
public var soundMP3:String;
// Define constructor.
public function MySoundParamInstance(targetObj:Object) {
super(targetObj);
}
// Override play() method.
override public function play():void
// You must call super.play() from within your override.
super.play();
s = new Sound();
// Use the new parameter to specify the URL.
u = new URLRequest(soundMP3);
s.load(u);
sndChannel=s.play();
}
// Override end() method to stop the MP3.
override public function end():void
sndChannel.stop();
super.end();
}
}
}
236
Creating Effects
method still returns an empty Array. That is
returns the list of properties of the effect target that are
{
{

Advertisement

Table of Contents
loading

Table of Contents