現在我們先看看**,下面的**裝在creationcomplete事件中呼叫init()來啟動全屏.
現在儲存執行一下swf,卻有typeerror..詳細資訊如下
view plain
copy to clipboard
print?
main thread (suspended: typeerror: error #1009: 無法訪問空物件引用的屬性或方法。)
swf_fullscreen/init
flash.events::eventdispatcher/dispatcheventfunction [no source]
flash.events::eventdispatcher/dispatchevent [no source]
mx.core::uicomponent/dispatchevent
mx.core::uicomponent/set initialized
mx.managers::layoutmanager/dophasedinstantiation
mx.core::uicomponent/calllaterdispatcher2
mx.core::uicomponent/calllaterdispatcher
我們把init()修改一下,如果
view plain
copy to clipboard
print?
private function init():void
private function init():void
執行儲存執行swf,發現輸入null,奇怪的事情發生了..stage竟然為null,那進行stage.displaystate當然就報錯了...
再次修改程式,使用click呼叫init(),stage正常輸出,那問題大概就是creationcomplete呼叫時,stage初始化..
後來網上查了一下..發現了乙個叫calllater的函式,他的功能大概是..進入下一幀的時候,執行函式,我們再次修改**:
view plain
copy to clipboard
print?
<?xml version="1.0" encoding="utf-8"?>
creationcomplete="calllater(init)"
>
private function init():void
]]>
我們在creationcomplete事件裡,使用calllater(init)來呼叫init,讓init在進入下一偵的時候再全屏..
儲存執行swf,問題解決....
ps:另外swf還可以使用fscommand("fullscreen", "true");來進行全屏..這裡只是主要討論stage為null的問題.
flex裡關於stage的問題
問題描述 自定義乙個as的類,裡面包含了stage的 然後在flex project裡呼叫,編譯沒有報錯,彈出視窗後,發現場景無法顯示,百思不得其解,於是到網上check一下原因,終於發現問題的解決方法 自定義的as類裡,新增乙個事件 this.addeventlistener event.adde...
Spark中stage的劃分
如下為spark中劃分stage的原始碼 dagscheduler將job分解成具有前後依賴關係的多個stage dagscheduler是根據shuffledependency劃分stage的 stage分為shufflemapstage和resultstage 乙個job中包含乙個results...
MVP在 Flex中的應用
關於mvp是mvc的另一種模式,在mvp模式中檢視和模型是完全分離的,他們通過presenter進行互動。presenter與控制器非常相似,但是它們也有一些的區別 1 presenter處理檢視傳送過來的使用者操作 在mvc中檢視自己處理了這些操作 2 它用更新過的資料去更新模型 在被動mvc中控...