AS3 : Display programming and Event Listeners

My study of “Essential Actionscript 3.0 ” continues…

To reduce memory and processor usage, event listeners should always be unregistered when they are no longer needed in a program.
For eventListeners registered to the ancestor of the display objects :
event.currentTarget : refers to the display object’s ancestor
event.target : refers to the actual object,which trigered the event

Dispatching a new custom event in Actionscript is as simple as extending the EventDispatcher class, giving the new event a name, and invoking the EventDispatcher class’s instance method dispatchEvent();
The object on which dispatchEvent() is invoked is the event target.

Display objects :
addChild() : adds a display object to the Application’s Main swf ( displayObj.root returns the Main Application Object )
stage.addChild(): adds a display object to the stage ( displayObj.root returns the Stage Object )

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s