1 Reply Latest reply on Aug 31, 2011 9:07 PM by sanika Kulshreshtha

    [iOS] Advice on when to close events


      hi all just looking for some advice on when to close some events ..


      my problem is i am working on a iOS app that loads two large swf files and plays them both at the same time. i am loading in the video files on the first frame and adding them to the stage on the second.. the problem is it crashs at random it seems, ( crashes the frist time it loads files , then stable for 5 or 6 runs then crashes again and wont work till i have to reset ipad ) however it crashes at the same place always .. after loading the files.


      also the swf files do not have any AS3 code in them, however they are large 9000 - 11000 frames each



          import flash.desktop.NativeApplication;
          import flash.desktop.SystemIdleMode;
          import flash.net.URLRequest;
          import flash.display.Loader;
          import flash.events.Event;
          import flash.events.ProgressEvent;
          import flash.filesystem.File;
          import flash.display.MovieClip;

      //----- sleep & wake settings
      NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
      stage.addEventListener(Event.DEACTIVATE, ReleaseWakeLock);
      final function ReleaseWakeLock(event:Event):void


           NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.NORMAL;


      stage.addEventListener(Event.ACTIVATE, RequestWakeLock);
      final function RequestWakeLock(event:Event):void


                NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;


      // vars
      var load1 = 0;
      var load2 = 0;
      var mc1:MovieClip = new MovieClip;
      var mc2:MovieClip = new MovieClip;


      // load video 1



      function startLoad()


           var file2:File = File.applicationDirectory.resolvePath("v1.swf");
           var mLoader2:Loader = new Loader();
           var mRequest2:URLRequest = new URLRequest(file2.url);
           var context2:LoaderContext = new LoaderContext();
           context2.checkPolicyFile = true;
           context2.securityDomain = SecurityDomain.currentDomain;
           context2.applicationDomain = ApplicationDomain.currentDomain;
           mLoader2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
           mLoader2.contentLoaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUG HT_ERROR, handleGlobalErrors);
           mLoader2.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
           mLoader2.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);



                     mLoader2.load(mRequest2, context2);

           catch (error:Error)




      function onCompleteHandler(loadEvent:Event)





      //-------- start of video loader 2


      function startLoad2()


           var file:File = File.applicationDirectory.resolvePath("v2.swf");
           var mLoader:Loader = new Loader();
           var mRequest:URLRequest = new URLRequest(file.url);

           var context:LoaderContext = new LoaderContext();
           context.checkPolicyFile = true;
           context.securityDomain = SecurityDomain.currentDomain;
           context.applicationDomain = ApplicationDomain.currentDomain;
           mLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
           mLoader.contentLoaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGH T_ERROR, handleGlobalErrors);
           mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler2);
           mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);



                mLoader.load(mRequest, context);

           catch (error:Error)




      function handleGlobalErrors( evt : UncaughtErrorEvent ):void


      function onCompleteHandler2(loadEvent:Event)

           load2 = 1;


      function ioError(event:ErrorEvent):void






        • 1. Re: [iOS] Advice on when to close events
          sanika Kulshreshtha Adobe Employee


          Thanks for reporting this issue. Since you are loading very large swfs, it could be possible that iOS is killing your application, since it is consuming a lot of memory. How large are the swfs?

          Could you please file a bug at http://bugbase.adobe.com and attach any test applications that you have? I request you to please post the bug number here so that other developers affected by the bug can vote for it.

          One more thing, you could also set stage.quality = StageQuality.MEDIUM in case you have set it to HIGH.