隨筆-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, 犧牲這個....



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


          網站導航:
           
          主站蜘蛛池模板: 万荣县| 鹿泉市| 竹山县| 岢岚县| 梓潼县| 清水河县| 会同县| 萨嘎县| 商洛市| 道真| 句容市| 兰考县| 垦利县| 霍山县| 镇宁| 蒲江县| 子洲县| 溆浦县| 玉山县| 汾西县| 合水县| 罗平县| 龙海市| 肃宁县| 光山县| 宝山区| 阿鲁科尔沁旗| 金阳县| 榆社县| 达州市| 霍林郭勒市| 武强县| 漳浦县| 石门县| 大冶市| 武隆县| 彩票| 和平区| 新营市| 五寨县| 故城县|