Adobe-Runtime-Support
Adobe-Runtime-Support copied to clipboard
How to load swf files from the sever in order to reduce app size
I am trying to load swf files from the server to reduce the app size. But i am getting error. can any one give some solution?
Hello,
I have no experience in iOS development, but have to remind you: If you tries to load SWF in AIR app on iOS, due to Apple's policy, applications are not allowed to load external code or other JIT technologies without being reviewed by the App Store. So AIR for iOS can't load SWF, and they are not using ABC as software.
For other OS, loading external SWF is a very normal behavior. You should show more information about the issue, including SDK version, sample code and so on…
Could you provide sample code for android OS
I think load SWF from a server is clear easy and isn't it a basic operation in Flash development?
Just something like this:
package yourpackagename {
import flash.display.Sprite;
import flash.display.Loader;
import flash.events.Event;
import flash.net.URLRequest;
public class SimpleClass extends Sprite {
private var loader:Loader = new Loader();
public function SimpleClass() {
loader.load(new URLRequest("http://yourDomain.com/URL/to/SWF/file.swf"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, handlerForLoadComplete);
}
private function handlerForLoadComplete(e:Event) {
//things to do on load complete
//For example: Add as child
addChild(e.target.content);
}
}
}
I think this is enough, isn't it the same operation as on Windows/MacOS? I did the same when developing Android. Or do you encounter problems during regular loading?
Let me implement the codes you have given and get back to you with the result. Thanks
If you're just looking at SWFs with resources, then that should work, but I think if you want to access AS3/code definitions from the loaded SWF within your main application then you'd also need to pass in a LoaderContext to the load() command, with the "allowCodeImport" value set to true.