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



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


          網站導航:
           
          主站蜘蛛池模板: 金乡县| 调兵山市| 当涂县| 新郑市| 砀山县| 饶平县| 凤翔县| 依兰县| 姜堰市| 高密市| 临颍县| 祁阳县| 东山县| 海盐县| 台安县| 密云县| 西宁市| 拉孜县| 红安县| 长治市| 永寿县| 温州市| 台北市| 淅川县| 广河县| 闽侯县| 碌曲县| 临清市| 黄平县| 庆元县| 虞城县| 洛南县| 阿鲁科尔沁旗| 策勒县| 呼和浩特市| 南溪县| 隆德县| 波密县| 长武县| 余庆县| 茶陵县|