• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
1

Loading multiple swfs using air 3.6 for ios

Community Beginner ,
Dec 11, 2012 Dec 11, 2012

Copy link to clipboard

Copied

Adobe, can you please provide us with the code to load multiple swf files for ios. Please provide examples. The code below loads multiple swfs, but the swfs stall, so this does not seem to be a solution.

Code description: A flash file made up of 4 frames with forward and back buttons that navigate from frame to frame. The code loads three different swf files in frames 2, 3 and 4.


Frame 1:

var myLoader:Loader;

var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);

if(myLoader == null){myLoader = new Loader(); addChild(myLoader); }

else {myLoader.unload();}

Frame 2:

  1. myLoader.unload();
  2. myLoader.load(new URLRequest("file1.swf"),loaderContext);

Frame 3:

  1. myLoader.unload();
  2. myLoader.load(new URLRequest("file2.swf"),loaderContext);

Frame 4:

  1. myLoader.unload();
  2. myLoader.load(new URLRequest("file3.swf"),loaderContext);

TOPICS
Air beta

Views

13.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 08, 2013 Apr 08, 2013

Copy link to clipboard

Copied

That's good to know, but how I should you aceess assets from the app if I am not exporting symbols' for Action Script (to avoid inclusion of ABC code)?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 06, 2013 May 06, 2013

Copy link to clipboard

Copied

My team is attempting to unload SWFs and load them a second time on iOS. We're using the functionality Nimisha referred to in #24, i.e. the "stripped SWFs" pipeline.

I'm still receiving an error of "Reloading a SWF is not supported on this operating system" when I attempt to unload and reload the same SWF.

In fact, when I experiment with unloading a Loader used to load in such a stripped SWF, I find that it is staying in memory even after I null-out the only reference to it, and run both unload() and unloadAndStop() on it. I assume this is related to the iOS-specific functionality mentioned above.

Nimisha's last comment seemed to imply that the stripped-SWF pipeline would make this reloading functionality work. If that's the case, then is this a bug? I'd be happy to share the simple test project I've created.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
May 06, 2013 May 06, 2013

Copy link to clipboard

Copied

Hi IQpierce0,

Please don't get confused between pure asset SWFs and stripped SWFs. Both are different and reloading for pure asset SWFs will work but will not work for stripped SWFs.

-Nimisha

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 06, 2013 May 06, 2013

Copy link to clipboard

Copied

Nimisha,

Thanks for the clarification that reloading does not currently work for stripped SWFs. My next questions are:

  1. Why?
  2. Is this considered a bug?
  3. Is there a timeline to be able to do this?

I noticed that in the latest AIR 3.7 SDK beta release notes, the first "Known Issue" is "3525750 - Reloading of a SWF which contains any ABC code throws an error 3764". Does that mean that this is acknowledged as a bug, and going to be fixed in the next version of AIR Mobile?

My team is working on an app that can loaded in thousands of remote SWFs (legacy content), and they need to have some ABC code on them. The set of content is well-defined, so we were planning to use the "stripping" pipeline.

However, this reloading limitation makes all of this useless. Being able to load remote SWF content is almost impossible if you're unable to reload those SWFs.

It would help to know exactly why this limitation exists - why is error #3764 being thrown? Why does it happen for stripped SWFs (which have no bytecode being downloaded) and not for graphical SWFs (which also have no bytecode being downloaded)?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
May 07, 2013 May 07, 2013

Copy link to clipboard

Copied

This is not considered as a bug but a limitation.

>>It would help to know exactly why this limitation exists - why is error #3764 being thrown? Why does it happen for stripped SWFs (which have no bytecode being downloaded) and not for graphical SWFs (which also have no bytecode being downloaded)?

The SWFs which are converted to stripped SWFs have code initially which is compiled while the AOT packaging  and when stripped SWF is loaded, it is loaded with the compiled code.

That is why reloading will not work with the stripped SWF as the SWF has to be loaded with the code which is the not the case with the pure asset SWFs.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 21, 2013 May 21, 2013

Copy link to clipboard

Copied

I've just tried loading, unloading and then loading again same SWF with 2 library objects linked for AS3 export. It worked both on simulator and on device in debug mode. When I look inside swf it does contain AS3 code.

So is my swf a pure asset SWF? Or Intellij Idea 12 that I'm using does stripping automatically?

And then I've read your comment at http://forums.adobe.com/message/5217325#5217325 and run 'swfdump' utility on my .swf file. Looks like there's no ABC2 code, that's why app was able to load, unload and load again the same swf.

public dynamic class net.games.bg extends flash.display.MovieClip
{
  native public function bg():*;
  native public var one:flash.display.MovieClip;
  native public var three:flash.display.MovieClip;
  native public var two:flash.display.MovieClip;
}

public dynamic class net.games.z1 extends flash.display.MovieClip
{

  native public function z1():*;
}

I can access objects as instances through root  or as objects through getDefinition.

private var aLoader : Loader;
 private function init():void
        {

            load1();

        }
        private function load1():void
        {
            aLoader   = new Loader();
            var url:URLRequest = new URLRequest("levels/expirementlevel1.swf");
            var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
            aLoader.load(url, loaderContext); // load the SWF file
            aLoader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, handleSWFLoadComplete1, false, 0, true);
        }

        private function handleSWFLoadComplete1(e:flash.events.Event):void {
            var levelObjectsMC:flash.display.MovieClip = e.target.loader.content;
            for (var i:uint = 0; i < levelObjectsMC.numChildren; i++){
                trace ('\t|\t ' +i+'.\t name:' + levelObjectsMC.getChildAt(i).name + '\t type:' + typeof (levelObjectsMC.getChildAt(i))+ '\t' + levelObjectsMC.getChildAt(i).x);
            }
            var LibraryClass:Class = e.target.applicationDomain.getDefinition("net.games.z1") as Class;
            var myLibraryObject:flash.display.MovieClip = new LibraryClass as flash.display.MovieClip;
            trace(' load 1 ' + myLibraryObject);
            aLoader.unload();

            load2();
            //addChild(levelObjectsMC);

        }
        private function load2():void
        {
            aLoader   = new Loader();

            var url:URLRequest = new URLRequest("levels/expirementlevel1.swf");
            var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
            aLoader.load(url, loaderContext); // load the SWF file
            aLoader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, handleSWFLoadComplete2, false, 0, true);
        }
        private function handleSWFLoadComplete2(e:flash.events.Event):void {
            var levelObjectsMC:flash.display.MovieClip = e.target.loader.content;
            for (var i:uint = 0; i < levelObjectsMC.numChildren; i++){
                trace ('\t|\t ' +i+'.\t name:' + levelObjectsMC.getChildAt(i).name + '\t type:' + typeof (levelObjectsMC.getChildAt(i))+ '\t' + levelObjectsMC.getChildAt(i).x);
            }
            var LibraryClass:Class = e.target.applicationDomain.getDefinition("net.games.z1") as Class;
            var myLibraryObject:flash.display.MovieClip = new LibraryClass as flash.display.MovieClip;
            trace('load 2 x ' + myLibraryObject.x);
            aLoader.unload();


        }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 10, 2013 Jun 10, 2013

Copy link to clipboard

Copied

In my mobile app I use new compiler ASC 2.0. And on iOS has bugs. If secondary  SWF compile with ASC 2.0

1) In release build,  loading never complete

2) Has 7-8 FPS,but if compile with mxmlc - 30FPS

Tested on Ipad2, iPad 4

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Jun 10, 2013 Jun 10, 2013

Copy link to clipboard

Copied

Hi V.Zhelezny,

I can load a secondary SWF which is compiled with ASC 2.0. Can you please provide more details about your problem like which AIR SDK you're using? Also you can share a sample app(source code , SWFs, app-xml and all assets with which IPA can be packaged) with which I can reproduce the defect. Also don't forget to add the steps to reproduce.

Thanks,

Nimisha

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 11, 2013 Jun 11, 2013

Copy link to clipboard

Copied

Hi

AIR SDK 3.7 and secondary SWF has ABC code.

Try share small sample tomorrow

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 24, 2016 Oct 24, 2016

Copy link to clipboard

Copied

LATEST

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines