Skip to content Skip to sidebar Skip to footer

How Can I Play A Swf File Using Webview And Accessing The File From My Assets Directory?

I am new to both android and flash development. I am creating a metronome for my guitar app by using flash to implement the metronome portion. I already have a working project for

Solution 1:

Some times it may happen that the swf file get loaded on the web view by is not displayed.

Try adding android:android:hardwareAccelerated="true" in your manifest file.

<applicationandroid:hardwareAccelerated="true"><activity... /><activityandroid:hardwareAccelerated="true" /></application>

It might help...

Solution 2:

Like Akshay mentioned above,

<activityandroid:hardwareAccelerated="true" />

needs to be added, however I was having an issue where the swf would not load in full or load the initial swf. My solution was to point the

publicvoidonCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mWebView = (WebView) findViewById(R.id.web_engine);
    mWebView.getSettings().setPluginsEnabled(true);
    mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); 
    mWebView.setBackgroundColor(Color.parseColor("#000000"));
    mWebView.loadUrl("file:///android_asset/swfFile.html");


}

Keep in mind that to use setPluginsEnabled you need to downgrade your API version to 10 or 11.

And your html file is normally generated when publishing your swf file or you can add:

<divid="flashContent"><objectclassid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"width="100%"height="100%"id=**"Something**" align="middle"><paramname="movie"value="**Something.swf**" /><paramname="quality"value="high" /><paramname="bgcolor"value="#000000" /><paramname="play"value="true" /><paramname="loop"value="true" /><paramname="wmode"value="direct" /><paramname="scale"value="showall" /><paramname="menu"value="true" /><paramname="devicefont"value="false" /><paramname="salign"value="" /><paramname="allowScriptAccess"value="sameDomain" /><!--[if !IE]>--><objecttype="application/x-shockwave-flash"data="**Something.swf**"width="100%"height="100%"><paramname="movie"value="**Something.swf**" /><paramname="quality"value="high" /><paramname="bgcolor"value="#000000" /><paramname="play"value="true" /><paramname="loop"value="true" /><paramname="wmode"value="direct" /><paramname="scale"value="showall" /><paramname="menu"value="true" /><paramname="devicefont"value="false" /><paramname="salign"value="" /><paramname="allowScriptAccess"value="sameDomain" /><!--<![endif]--><ahref="http://www.adobe.com/go/getflash"><imgsrc="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"alt="Obtener Adobe Flash Player" /></a><!--[if !IE]>--></object><!--<![endif]--></object></div>

Post a Comment for "How Can I Play A Swf File Using Webview And Accessing The File From My Assets Directory?"