我正在尋找處理我的本地連接,當電影關閉,或卸載,我應該做什麼事與此?Flex是否有主電影的onclose/onunload事件?
0
A
回答
1
我不相信有,但我認爲你可以強制關閉無論如何。
不完全確定這將是多麼簡單,但這裏是我最好的猜測。當實例化你的LocalConnection,一定要包括這在客戶端(或作爲AS2屬性):
function close()
{
myConnection.close();
}
除此之外,我會包括這個試圖具有連接連接:
var commName:String = "MY_CONNECTION";
var myConnection:LocalConnection = new LocalConnection();
// Try to tell any open LocalConnection on this channel to close.
// This may cause an AsyncErrorEvent, so be sure to add the appropriate
// Error handling.
myConnection.send(commName, "close");
try
{
myConnection.connect(commName);
}
catch(error:Error)
{
// If there is another connection already open on the same channel,
// that will cause an Error. I have had some luck catching that
// Error and then calling connect again. That said, you would be
// best to take precautions anyway.
try
{
myConnection.connect(commName);
}
catch(error:Error)
{
// Your connection cannot connect!!!
// DO SOMETHING!!!
}
}
myConnection.client = this;
0
我想你可以對JavaScript中的unload事件作出反應,並通過ExternalInterface調用flex應用程序中的某些清理函數。雖然並沒有使用ExternalInterface,但我並不確定。
相關問題
- 1. Flex。停止電影
- 2. 是否有可能以同步的方式處理Flex事件?
- 3. Flex移動 - 是否有可能對啓動畫面有影響?
- 4. 有沒有好的電影/電影API?
- 5. jQuery - 使用多個就緒事件是否有負面影響?
- 6. 是否可以用ffmpeg創建示例電影(迷你電影)?
- 7. 是否有「主」gyp文件?
- 8. 是否有connect.static事件?
- 9. C++中是否有事件?
- 10. wx.DC行是否有事件?
- 11. Html.BeginForm是否有OnSuccess事件
- 12. pagerControls是否有onclick事件?
- 13. 觀察者模式:事件處理器是否會影響主題執行?
- 14. 排序電影由兩件事情
- 15. Flex電影重疊其他HTML
- 16. 是否存在與「flex-grow」屬性(或「flex」)相關的交叉軸,它僅影響主軸?
- 17. Flex DRAG_DROP事件 - 是否可以訪問被拖動的圖像?
- 18. 是否有任何電話鎖定事件?
- 19. 是否有可能調用java主事件循環?
- 20. 主機文件是否影響到即興連接的設備?
- 21. 事務範圍是否影響性能?
- 22. WordPress的主題是不會有影響?
- 23. Flex Datagrid事件
- 24. 是否有一個「電影學分滾動」風格插件的單詞列表?
- 25. 什麼是Flex中的事件冒泡?
- 26. 在事件傳播過程中,是否可以用flex取消事件?
- 27. 自動檢測是否有投影機連接到電腦
- 28. 是否有類似'onload`的Ember事件
- 29. 是否有HTML5音頻的oncomplete事件?
- 30. 是否有全球感動的事件?
這看起來不錯。我有興趣明確關閉連接,因爲我明白連接名稱必須是唯一的,並且如果頁面重新加載,我不希望連接浮動並導致問題。 – Irwin 2009-08-07 17:19:15