MummyDing MummyDing - 1 month ago 33
Android Question

[Android]How to load swf file in Android (API 23)

I want to load swf file in Android , but it seems that Android don't support swf.

I google it,and most of developers suggest to use webview:

WebSettings settings = webview.getSettings();
settings.setPluginsEnabled(true);
webView.getSettings().setPluginState(WebSettings.PluginState.ON);
webView.loadurl("....swf");


but setPluginsEnabled was removed and setPluginState is deprecated in Api level 23.

Answer

"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)