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

AIR 3.6 & 3.7 SWF Loading Confusion

Contributor ,
Mar 29, 2013 Mar 29, 2013

Copy link to clipboard

Copied

Hello,

I am developing an application for the desktop and mobile platforms. I am using Flex and FB 4.7. One thing that is very important to me is the ability to load external swf files into the application. I am confused by what designates 'embedded AS code' in the swf file being loaded that will cause an error.

Currently, using 3.4 & 3.5 I can load external swf files on IOS that contain AS3 code, although I am not sure why this is because everything in this forum and the blogs state that this is only possible in 3.6+. I can also reload them without issue. In frame 1 of each swf I load, I have this code:

import flash.system.Security;

if (Security.sandboxType == Security.REMOTE)

{

          Security.allowDomain("*");

}

stop();

This code is used because these same swf assets are used on the web in a browser. In eash swf file, it also has a symbol in it's Library which has a AS Linkage name defined. This symbol is used on the stage of the external swf. All of these are created with Flash Pro CS6. So at runtime within my main application I load these and inject event code into the symbol instances on stage, the same symbol that has the AS Linkage in the library of each swf file I load. This works well.

So I can load/reload them in my application fine, even though I thought any swf file with AS3 code would not load on IOS. So is there an undocumented guidleine or something on the amount of AS code that can be within a swf file before it will error on IOS when loaded?

thx

TOPICS
Air beta

Views

3.8K

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
Contributor ,
Apr 01, 2013 Apr 01, 2013

Copy link to clipboard

Copied

Hello, I would really like to hear one of the AIR developers comment on this if possible. I can't understand why this works, but when I try and load other swf files with no AS code but that have symbol definitions with AS Linkage names, I can't.

thx

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
LEGEND ,
Apr 01, 2013 Apr 01, 2013

Copy link to clipboard

Copied

Having it shared for ActionScript in the library will cause there to be a Class created. So, although you think it has no code, by the time it's a swf it will have 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
Contributor ,
Apr 01, 2013 Apr 01, 2013

Copy link to clipboard

Copied

I originally thought that too, but as I mentioned in my first post, I can load external swf files that have the above code in them on the first frame. The external swf files also have symbols with AS Linkage names too. What seems to cause an issue though is when I try to "reach into" the external swf file and manipulate the symbols, using code like:

var AssetClass:Class = _loader.contentLoaderInfo.applicationDomain.getDefinition(id) as Class;

mc = new AssetClass();

That code works, but the app will lockup if I try and load it more than once. So apparently it's OK to have a certain amount of AS code in the external swf files, I am just trying to figure out what the "limit" is, because from my tests the statement "can contain no AS code" is false.

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
Apr 01, 2013 Apr 01, 2013

Copy link to clipboard

Copied

Hi Keith,

Well ideally secondary SWF (whether external or not) containing any ABC code can't be reloaded  on iOS and there is no "limit" of using any AS code to make reload work. But your case looks like an exception to me. Can you share your app(with sources) or may be part of your app which can explain your case at dropbox and share link with me @nimisha1@adobe.com?

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
Contributor ,
Apr 02, 2013 Apr 02, 2013

Copy link to clipboard

Copied

I can't share the whole project because it is too big, but I will send you the claas that is doing the loading and manipulation of the loaded swf's symbols, as well as the fla file that I used to publish the swf I am loading.

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
Contributor ,
Apr 02, 2013 Apr 02, 2013

Copy link to clipboard

Copied

@Nimisha1

Ok I think I understand what is going on now, but please confirm. I trimmed down the size of my FB project because it was taking so long to package and test. I did this by removing 2/3 of the swf assets like the one I sent to you. When I degugged the app, I noticed in the FB console that it was now reporting that the size of the main swf file had decreased. So was this the result of less code from the stripped swf assets being inserted into the main swf file? If so, I was completely by this, because I did not think this would happen until 3.6.

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
Apr 02, 2013 Apr 02, 2013

Copy link to clipboard

Copied

Keith,

>>So was this the result of less code from the stripped swf assets being inserted into the main swf file?

Yes. In AIR 3.6 with multiple swfs feature on iOS we started embedding all ABC code of the secondary SWFs into the main/root SWF (as for iOS we can load only compiled code) and all the secondary SWFs go as stripped SWFs in the IPA.

I hope it clears all the doubts!

-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 ,
Apr 08, 2013 Apr 08, 2013

Copy link to clipboard

Copied

I'm also confused what do you mean by content only swf? If I publish swf without 'export for AS' option how would I access assets that are inside that SWf from my main app?

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
Apr 09, 2013 Apr 09, 2013

Copy link to clipboard

Copied

Hi Rgbastrost,

Even if your SWF is containing any ABC code (i.e you're doing 'export for AS') you can still load it on iOS in AOT/Interpreter mode (be it locally or externally).

>>I'm also confused what do you mean by content only swf?

This means that SWF doesn't contain any "DoABC2 " tag in it.

The easiest way to identify if your swf has ABC code or not is to simply run swfdump on your swf and then search for a DoABC2 tag. The executable swfdump is available as part of the SDK.

FlexSDK/bin/swfdump mySWF.swf | grep DoABC2                                            (On MAC)

FlexSDK/bin/swfdump.exe mySWF.swf | find “DoABC2″                                  (On Windows)


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
Contributor ,
Apr 09, 2013 Apr 09, 2013

Copy link to clipboard

Copied

Is there anywhere at all where all of this knowledge about what can/can't be loaded on the different platforms is documented? It would really be helpful to AIR developers if this stuff was documented in a central place vs. having to go from blogs to forum threads to find info.

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 25, 2013 Jun 25, 2013

Copy link to clipboard

Copied

LATEST

Hi Nimisha,

I cann't able to reload the external stripped swf(contains ABC code) more than once since it is restricted in ios device.  Is there any workaround for reloading the external stripped swf in ios platform?

Thanks,

M.Senthil Kumar

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