com.asual.enflash.EnFlashObject
EnFlashObject is the base class of the EnFlash Framework. It provides object identification, hierarchical referencing, event handling and XML serialization/deserialization.
new EnFlashObject()
public oninit:FunctionEvent that notifies when this object is initialized.
public onremove:FunctionEvent that notifies when this object is removed.
public id:String [Read Only]The ID of this object
public parent:Object [Read Only]The parent of this object
public ref:Number [Read Only]The reference number of this object that is used in the EnFlash hierarchy.
public function toString():StringBasic method that returns the type of this object.
- Return
- The type of this object
public function main(parent:Number):VoidInitializes this object and makes it part of the EnFlash hierarchy.
- Parameters
parent- Parent's reference
public function getXML():XMLNodeGenerates an XML structure that contains all the information available for this object.
- Return
- XML representation of this object
public function setXML(xml:XMLNode):VoidLoads an XML structure that contains public properties, event listeners and inline objects.
- Parameters
xml- XML represantation of this object
public function addEventListener(type:String, object:Object, method:Function, args:Object):VoidAdds event specific listeners to this object.
Example:addEventListener("init", myObject, myObject.methodName, {neededObject: someObject});
- Parameters
type- Event typeobject- The object that will listen for the eventmethod- The method that will be invoked when the event is dispachedargs- (optional) Additional object with custom properties that will be received by the listener
public function removeEventListener(type:String, object:Object, method:Function):VoidRemoves event specific listeners from this object.
Example:removeEventListener("init", myObject);
- Parameters
type- Event typeobject- The object that will be removed from the listeners collectionmethod- (optional) Method reference that specifies exactly which couple of object/method has to be removed. This can be used when an object listens for specific event with multiple methods
public function dispatchEvent(type:String, params:Object):VoidDispatches event to all available listeners.
Example:dispatchEvent("init", object1, object2.someProperty,...objectN);
- Parameters
type- Event typeparams- (optional) Additional event specific parameters
public function dispatchEventOnce(object:Object, type:String, params:Object):VoidDispatches event to a single listener.
Example:dispatchEventOnce(listenerObject, "init", object1, object2.someProperty,...objectN);
- Parameters
object- Known listener objecttype- Event typeparams- (optional) Additional event event specific parameters
public function getListeners(type:String):ArrayProvides a list of event specific listeners.
- Parameters
type- Event type- Return
- Array of objects with 3 properties: object, method and arguments
public function createDelegate(object:Object, method:Function, args:Object):FunctionCreates a delegate for an event that will be handled in the specified scope. This method is useful when working with Flash's build-in objects.
- Parameters
object- The object that provides a scope for the event executionmethod- Method reference that will handle the eventargs- (optional) Object containing custom properties that will be passed together with the event- Return
- Delegate function
public function removeDelegate(object:Object, method:Function):VoidRemoves a previously created delegate.
- Parameters
object- Object that has a method with an assigned Delegatemethod- The method that is binded to a Delegate that has to be removed
public function debug(msg:String):VoidDisplays program messages in a top-level Label instance.
Example:debug("myObject", myObject,...myObject.someProperty);
- Parameters
msg- One or multiple objects and values to be displayed.