Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 43

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

Advertisement

You can use this technique when you define your event classes. The following example
modifies the definition of the EnableChangeEventConst class to include a static constant for
the
property:
type
package myEvents
{
//events/myEvents/EnableChangeEventConst.as
import flash.events.Event;
public class EnableChangeEventConst extends Event
{
// Public constructor.
public function EnableChangeEventConst(type:String,
isEnabled:Boolean=false) {
// Call the constructor of the superclass.
super(type);
// Set the new property.
this.isEnabled = isEnabled;
}
// Define static constant.
public static const ENABLE_CHANGED:String = "myEnable";
// Define a public variable to hold the state of the enable property.
public var isEnabled:Boolean;
// Override the inherited clone() method.
override public function clone():Event {
return new EnableChangeEvent(type, isEnabled);
}
}
}
Dispatching custom events
43

Advertisement

Table of Contents
loading

Table of Contents