写flex组件,了解UIComponent的生命周期(life cycle)很重要,尤其是初始化(initialization)的过程很复杂,贴个文件可以很容易看清这个顺序
文件如下:
package
{
import flash.events.Event;
import mx.core.UIComponent;
import mx.events.FlexEvent;
public class UILifeCycle extends UIComponent
{
public function UILifeCycle()
{
super();
trace("***[ constructor ]");
//flash.events.Event
this.addEventListener(Event.ADDED,onAdded);
this.addEventListener(Event.ADDED_TO_STAGE,onAddedToStage);
this.addEventListener(Event.REMOVED,onRemoved);
this.addEventListener(Event.REMOVED_FROM_STAGE,onRemovedFromStage);
//mx.events.FlexEvent;
this.addEv