Skip to main content
Inspiring
March 29, 2013
Question

AIR 3.6 & 3.7 SWF Loading Confusion

  • March 29, 2013
  • 1 reply
  • 4094 views

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

This topic has been closed for replies.

1 reply

leejkAuthor
Inspiring
April 1, 2013

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

Colin Holgate
Inspiring
April 1, 2013

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.

leejkAuthor
Inspiring
April 2, 2013

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.