隨筆-159  評論-114  文章-7  trackbacks-0
          表現:
          使用ModuleManager去加載一個Module的時候, 所有的事件都激發不了.

          代碼:

          1.                 var testModule:IModuleInfo = ModuleManager.getModule('modules/pub/User.swf');
          2.                 testModule.addEventListener(ModuleEvent.READY,onModuleReady);
          3.                 testModule.addEventListener(ModuleEvent.SETUP, onModuleSetup);
          4.                 testModule.addEventListener(ModuleEvent.PROGRESS,onModuleLoading);
          5.                 testModule.load();

          打個賭, ModuleEvent里所有的事件都不會被激發.


          原因:

          addEventListener之后, testModule的Event Listeners就可能被GC了.




          解決:

          不要聲明局部IModuleInfo對象.


          相關鏈接:
          http://bugs.adobe.com/jira/browse/SDK-14021
          https://bugs.adobe.com/jira/browse/SDK-11389

          Gaurav Jain 同學說: 
          "References to IModuleInfo must be maintained to keep the event listeneres alive. If the IModuleInfo is defined in function local scope the event listeners may get garbage collected. "
          他表示:
          "This is NAB. The weak reference was a change to fix a memory leak bug (

          Not a bug~ 為了修復另一個bug, 犧牲這個....



          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 弋阳县| 潢川县| 冷水江市| 株洲市| 绥德县| 旅游| 师宗县| 高雄市| 会理县| 武胜县| 海安县| 克东县| 互助| 白河县| 灵璧县| 兴隆县| 平顶山市| 余江县| 汉阴县| 南漳县| 太仓市| 庆云县| 沙雅县| 沈阳市| 西和县| 山西省| 平邑县| 仁怀市| 丹东市| 进贤县| 筠连县| 蒲城县| 正定县| 朝阳县| 瑞金市| 江都市| 鹰潭市| 桦南县| 道孚县| 凉山| 靖远县|