problems with loading embedded swf files in air app
I suppose you're working with adobe air for mobile on your android device. In air for mobile, there is extra restrictions on loading external SWF files - especially when they contain byte codes(ActionScript). Because your secondary SWF file is containing actionscript code for itself, you cannot load into your mobile air application without explicit security allowance.
AS3 uses Loader
implicitly when you instantiate classes refering your embedded SWF files, and it loads with default option - which is set to different in air for mobile runtime environment.
You can load them with manual loading, by creating Loader
and LoaderContext
instance by yourself.
var ldr:Loader = new Loader();
var lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
lc.allowCodeImport = true;
ldr.load(new URLRequest("YOUR_FILE_PATH"), lc);
Also note that in iOS, even if allowCodeImport
is set to true, you cannot load external SWF with codes, by any means.
For further details : http://blogs.adobe.com/airodynamics/2012/11/09/packaging-and-loading-multiple-swfs-in-air-apps-on-ios/
Problem loading swf file in android
Replace
wv.loadDataWithBaseURL("null", html, mimeType, encoding, "");
with
wv.loadData(html, mimeType, encoding, "");
wv.getSettings().setJavaScriptEnabled(true);
[Android]How to load swf file in Android (API 23)
"but it seems that Android don't support swf"
Yes and as you've been told... Adobe stopped allowing Flash Player on mobile browsers. They instead recommend that you open FlashPlayer content within an app only because.. drumroll... Adobe have their own tool to create Android apps and only their tool allows opening SWF within a mobile app.
The catch is that any SWF loaded into an app cant just run its own code (could be un-safe code from a bad-minded person). So the next best things is to use Flash's own StageWebView to open a html page that has a flash embed and everything runs perfectly like on a computer browser (only this time via that StageWebView part of your Flash-made Android app).
So to answer..
I want to load swf file in Android
simply download the latest Flash CC (dev toolkit) and re-create your app through ActionScript-3 code instead of Java code. They are both C-like languages (though I feel AS3 is closer to C# than Java in terms of API names etc but as you can see where Java/Android has "WebView" well AS3 has "StageWebView" so it might not be that hard to switch for this app (if important enough to justify learning a new OOP language)
Air for Android. Swf not geting removed from memory i guess
To be able to completely stop and unload a loaded SWF, you need to invoke unloadAndStop() method on the Loader instance, that holds the loaded content. Like:
var outerSwf:Loader = new Loader;
// Load.
outerSwf.load(new URLRequest("outer.swf"));
addChild(outerSwf);
// ...
// Unload.
removeChild(outerSwf);
outerSwf.unloadAndStop();
Related Topics
Compatiblity of Material Design to Versions Below Android 5.0
Picasso Loading of Image Spawned Inside Asynctask
Calledfromwrongthreadexception
Implementing a Simple Dagger2 Sample
To Draw an Underline Below the Textview in Android
Why Isn't My Vector Drawable Scaling as Expected
Android Cursor with Ormlite to Use in Cursoradapter
Display Activity from Bottom to Top
Why a Viewmodel Factory Is Needed in Android
Android Downloadmanager Progress
Getactionview() of My Menuitem Return Null
Android Facebook Authorization - Can Not Log in When Official Facebook App Is Installed
Progress Bar While Loading Image Using Glide
Cordova Platform Add Android Not Working While Listing Android Targets