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



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


          網站導航:
           
          主站蜘蛛池模板: 沂水县| 黄冈市| 宣武区| 阿克苏市| 措勤县| 永春县| 湘阴县| 西和县| 罗甸县| 宝丰县| 上蔡县| 大城县| 都兰县| 绵竹市| 北宁市| 盐津县| 永康市| 嘉义市| 哈尔滨市| 和林格尔县| 山西省| 平度市| 曲靖市| 刚察县| 和龙市| 瑞昌市| 毕节市| 越西县| 乳源| 泽州县| 清苑县| 南昌市| 浙江省| 玉环县| 洮南市| 油尖旺区| 腾冲县| 雷州市| 奉贤区| 出国| 宝兴县|