隨筆-159  評(píng)論-114  文章-7  trackbacks-0
          表現(xiàn):
          使用ModuleManager去加載一個(gè)Module的時(shí)候, 所有的事件都激發(fā)不了.

          代碼:

          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();

          打個(gè)賭, ModuleEvent里所有的事件都不會(huì)被激發(fā).


          原因:

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




          解決:

          不要聲明局部IModuleInfo對(duì)象.


          相關(guān)鏈接:
          http://bugs.adobe.com/jira/browse/SDK-14021
          https://bugs.adobe.com/jira/browse/SDK-11389

          Gaurav Jain 同學(xué)說: 
          "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~ 為了修復(fù)另一個(gè)bug, 犧牲這個(gè)....



          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 汝南县| 安吉县| 三门峡市| 科技| 平湖市| 赣榆县| 宁蒗| 东宁县| 依兰县| 吉林市| 荣成市| 巩义市| 汕头市| 青神县| 潞西市| 井研县| 怀来县| 温泉县| 会宁县| 孟村| 萨嘎县| 临武县| 杭州市| 大洼县| 泾源县| 惠州市| 石河子市| 井研县| 收藏| 南漳县| 正定县| 大英县| 大庆市| 古丈县| 东乡县| 昭平县| 福贡县| 垫江县| 锦屏县| 仁布县| 仲巴县|