AS3 - Instantiating objects from external .swf in iOS
I'm looking to load external .swfs that have graphical assets in them which are all 'exported for actionscript', and instantiate those assets in a .swf packaged for iOS.
I'm using the adt command line packager to create the .ipa file. I'm including the .swf files while packaging. The .swf files seem to load correctly, and give me no errors, but when the Loader
for each .swf's bytesLoaded
equals bytesTotal
the content
property remains null.
The program works perfectly when I package the .ipa using the -target ipa-test-interpreter
flag, but not when I use the -target ipa-test
.
I'm assuming the problem is that iOS doesn't allow Flex developers to load external .swf files that contain actionscript, and the 'export for actionscript' in the external .swf files counts as actionscript for the purposes of Apple's security policies. I'm looking for confirmation as to whether or not this is the problem.
When using adt to pa开发者_开发问答ckage .ipa files, does iOS block external .swf files that have library assets that have been 'exported for actionscript'?
Similar discussion: http://forums.adobe.com/message/3728665
Thanks!
J
This IS possible.
However there are some limitations.
- You cannot use AS3 in the swf's if they are not loaded from the app source.
- And you have to run all the code in the same ApplicationDomain, which can cause weird errors with duplicate class names and such.
This is a official article from Adobe about how to do it: http://blogs.adobe.com/airodynamics/2012/11/09/packaging-and-loading-multiple-swfs-in-air-apps-on-ios/
I highly recommend using swc's as suggested by others tho, since it simplifies the process in many cases.
You are not allowed to load external swf files on apple devices when you are creating a app.
the solution for you would be: put all your graphics and everything else into swc file and then compile the one ipa file.
精彩评论