Highlighted

‘Load Never Completed ‘ Is it really this difficult to load an image or a swf??

Participant ,
Feb 06, 2017

Copy link to clipboard

Copied

I’m trying to load a swf that’s on a remote server.

Common sense, and some Adobe documentation, says that it should be done in the same way as loading from a swf stored locally:

       var request:URLRequest = new URLRequest("http://www.[yourdomain].com/externalSwf.swf");

         var loader:Loader = new Loader();

         loader.load(request);

addChild(loader);

I’m testing this with an AIR v22 project running straight from FlashCS5.5.  No problem with local loads.

I guess uncommon sense is needed because this results in:  Error #2036: Load Never Completed.  Same problem when trying to load an image this way, although I guess that URLLoader and a ByteArray might take care of that. But I really need to load swfs.  When I listen for loader.contentLoaderInfo.bytesTotal I get just a fraction of the real total.

I’m guessing that somehow this may involve application domains or security domains but I’ve no idea how to use them. I’ve seen many questions about about this asked here but haven’t found a working solution.

How DO you load a swf from a server into an Adobe AIR project?

Hi Umanoff,

I tried with a sample project at my end using the same code that you shared and AIR_24.0.180 on iOS 10.0.1.

But when I hit the URL (http://umanoff.com/SWFTEST.swf ) it gives me 404 Not Found error, So I tried with a sample swf hosting it on my local server and it gets loaded successfully once I specify exceptions to the default behavior.

Thanks,

Adobe AIR Team

TOPICS
Development

Views

470

Likes

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

‘Load Never Completed ‘ Is it really this difficult to load an image or a swf??

Participant ,
Feb 06, 2017

Copy link to clipboard

Copied

I’m trying to load a swf that’s on a remote server.

Common sense, and some Adobe documentation, says that it should be done in the same way as loading from a swf stored locally:

       var request:URLRequest = new URLRequest("http://www.[yourdomain].com/externalSwf.swf");

         var loader:Loader = new Loader();

         loader.load(request);

addChild(loader);

I’m testing this with an AIR v22 project running straight from FlashCS5.5.  No problem with local loads.

I guess uncommon sense is needed because this results in:  Error #2036: Load Never Completed.  Same problem when trying to load an image this way, although I guess that URLLoader and a ByteArray might take care of that. But I really need to load swfs.  When I listen for loader.contentLoaderInfo.bytesTotal I get just a fraction of the real total.

I’m guessing that somehow this may involve application domains or security domains but I’ve no idea how to use them. I’ve seen many questions about about this asked here but haven’t found a working solution.

How DO you load a swf from a server into an Adobe AIR project?

Hi Umanoff,

I tried with a sample project at my end using the same code that you shared and AIR_24.0.180 on iOS 10.0.1.

But when I hit the URL (http://umanoff.com/SWFTEST.swf ) it gives me 404 Not Found error, So I tried with a sample swf hosting it on my local server and it gets loaded successfully once I specify exceptions to the default behavior.

Thanks,

Adobe AIR Team

TOPICS
Development

Views

471

Likes

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
Feb 06, 2017 0
Adobe Employee ,
Feb 06, 2017

Copy link to clipboard

Copied

Hi Umanoff,

Kindly go through the below link and Please specify exceptions to the default behavior by adding keys to InfoAdditions tag of the application descriptor of your app.

URLRequest - Adobe ActionScript® 3 (AS3 ) API Reference

Please let us know if you still face any problem.

Thanks,

Adobe AIR Team

Likes

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
Reply
Loading...
Feb 06, 2017 0
Participant ,
Feb 07, 2017

Copy link to clipboard

Copied

First, thanks for looking into this for me. My test with the new InfoAdditions were not successful, neither on the desktop (Windows7) nor iOS (10.0.2).

My entire code for this test follows:

  1. import flash.errors.IOError;
  2. var context:LoaderContext = new LoaderContext();
  3. context.checkPolicyFile = true;
  4. //context.securityDomain = SecurityDomain.currentDomain;                    //not for local main swf
  5. context.applicationDomain = ApplicationDomain.currentDomain;
  6. var loader:Loader = new Loader();
  7. loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,progressreport);
  8. loader.contentLoaderInfo.addEventListener(Event.COMPLETE,showme);
  9. loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,gimmeAnError);
  10. loader.load(new URLRequest("http://umanoff.com/SWFTEST.swf"), context);
  11. //loader.load(new URLRequest("http://umanoff.com/jpg3.jpg"));          //try a jpg instead of a swf
  12. //loader.load(new URLRequest("SWFTEST.swf"));                              //for local testing
  13. function progressreport(e)
  14. {
  15.             trace('progress: '+loader.contentLoaderInfo.bytesLoaded);
  16.             trace('progress: '+loader.contentLoaderInfo.bytesTotal);
  17. }
  18. function showme(e)
  19. {
  20.             addChild(loader);
  21. }
  22. function gimmeAnError(e)
  23. {
  24.             trace('IOError here: '+e.errorID);
  25. }

and this is what the InfoAdditions part of my app.xml looks like:

<InfoAdditions>

    

<![CDATA[

              <key>UIDeviceFamily</key>

<array><string>2</string></array>

                        <key>NSAppTransportSecurity</key>

<dict>

<key>NSExceptionDomains</key>

                              <dict>

<key>www.umanoff.com</key>

<dict>

<!--Include to allow subdomains-->

<key>NSIncludesSubdomains</key>

<true/>

<!--Include to allow HTTP requests-->

<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>

<true/>

<!--Include to specify minimum TLS version-->

<key>NSTemporaryExceptionMinimumTLSVersion</key>

<string>TLSv1.1</string>

                              </dict>

</dict>

</dict>

              ]]>

            

</InfoAdditions>

Also: here's my traced output from the PROGRESS and IOERROR listeners.

[SWF] basic%20remote%20swf%20loader.swf - 3654 bytes after decompression

progress: 0

progress: 233

progress: 281

progress: 233

IOError here: 2036

Likes

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
Reply
Loading...
Feb 07, 2017 0
Adobe Employee ,
Feb 07, 2017

Copy link to clipboard

Copied

Hi Umanoff,

I tried with a sample project at my end using the same code that you shared and AIR_24.0.180 on iOS 10.0.1.

But when I hit the URL (http://umanoff.com/SWFTEST.swf ) it gives me 404 Not Found error, So I tried with a sample swf hosting it on my local server and it gets loaded successfully once I specify exceptions to the default behavior.

Thanks,

Adobe AIR Team

Likes

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
Reply
Loading...
Feb 07, 2017 0
Umanoff LATEST
Participant ,
Feb 08, 2017

Copy link to clipboard

Copied

  1. Thanks. The error was all mine – I had put SWFTEST.swf in the root instead of the html folder on my server! This works for me now on Windows; I’m sure it’ll be fine on iOS. Thanks again for your help, deesharm.

Likes

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
Reply
Loading...
Feb 08, 2017 0