demo:
<?xml version="1.0" encoding="utf-8"?>
xmlns:mx=""
layout="absolute"
backgroundgradientcolors="[#67cbff, #fcffff]"
color="#000000"
fontsize="12"
preinitialize="report( event , 'preinitialize' )"
initialize="report( event , 'initialize' )"
creationcomplete="report( event , 'creationcomplete' )"
>
[bindable]
public var outtextdata:string="";
public function report( event:event , value:string ):void
]]>
id="outtextarea"
text=""
right="10" left="10" top="50" bottom="10" alpha="0.5"
wordwrap="false"
initialize="report( event , 'initialize' )"
creationcomplete="report( event , 'creationcomplete' )"
/>
y="10" height="30" left="168" width="150"
id="hellobutton"
label="say hello"
initialize="report( event , 'initialize' )"
creationcomplete="report( event , 'creationcomplete' )"
rollover="report( event , 'rollover' )"
rollout="report( event , 'rollout' )"
click="report( event , 'click > hello!' )"
/>
id="goodbyebutton"
label="say goodbye"
y="10" left="10" height="30" width="150" color="#000000"
initialize="report( event , 'initialize' )"
creationcomplete="report( event , 'creationcomplete' )"
click="report( event , 'click > goodbye!' )"
/>
id="clearbutton"
label="clear"
y="10" left="326" height="30" color="#000000" right="10"
initialize="report( event , 'initialize' )"
creationcomplete="report( event , 'creationcomplete' )"
click="outtextdata='';report( event , 'click' )"
/>
這個應用執行時, 輸出了例項流程和事件流. 這下我們就能夠看到所有事件的觸發順序. 可以發現應用啟動後, 事件的順序是一定的. 下面是輸出的內容:
167ms >> eventflow0.preinitialize
183ms >> eventflow0.outtextarea.initialize
187ms >> eventflow0.hellobutton.initialize
188ms >> eventflow0.goodbyebutton.initialize
189ms >> eventflow0.clearbutton.initialize
189ms >> eventflow0.initialize
243ms >> eventflow0.outtextarea.creationcomplete
243ms >> eventflow0.hellobutton.creationcomplete
243ms >> eventflow0.goodbyebutton.creationcomplete
244ms >> eventflow0.clearbutton.creationcomplete
244ms >> eventflow0.creationcomplete
1807ms >> eventflow0.hellobutton.rollover
2596ms >> eventflow0.hellobutton.rollout
2954ms >> eventflow0.hellobutton.rollover
3170ms >> eventflow0.hellobutton.rollout
3543ms >> eventflow0.hellobutton.rollover
4052ms >> eventflow0.hellobutton.click > hello!
4267ms >> eventflow0.hellobutton.click > hello!
4474ms >> eventflow0.hellobutton.click > hello!
4569ms >> eventflow0.hellobutton.rollout
4907ms >> eventflow0.goodbyebutton.click > goodbye!
5130ms >> eventflow0.goodbyebutton.click > goodbye!
Flex Application 初始化順序
然後才是 preinitialize 在所有的初始化之前觸發,沒有子元件的定義,但是可以引用元件的變數.initialize 當所有子元件生成完成後觸發,在這個時間點還沒有元件被渲染出來.creationcomplete 元件定義完成並已經在顯示列表.所有的元件初始化完成並顯示.自定義的視覺化元件 ...
flex application初始化順序
然後才是 preinitialize 在所有的初始化之前觸發,沒有子元件的定義,但是可以引用元件的變數.initialize 當所有子元件生成完成後觸發,在這個時間點還沒有元件被渲染出來.creationcomplete 元件定義完成並已經在顯示列表.所有的元件初始化完成並顯示.自定義的視覺化元件 ...
Flex Application 初始化順序
然後才是 preinitialize 在所有的初始化之前觸發,沒有子元件的定義,但是可以引用元件的變數.initialize 當所有子元件生成完成後觸發,在這個時間點還沒有元件被渲染出來.creationcomplete 元件定義完成並已經在顯示列表.所有的元件初始化完成並顯示.自定義的視覺化元件 ...