8

I am loading Flash SWFs into an Android WebView.

I want the SWF to be instantly fullscreen and focused.

The class name that handles flash is com.adobe.flashplayer.FlashPaintSurface. Watching the log, when I fullscreen the flash manually, it calls com.adobe.flashplayer.FlashPaintSurface.toggleFullScreen().

The first part of my question is: How can I call that method manually for my Flash SWF?

Note that with a webview with a flash embedded, the only way I seem to be able to fullscreen it properly (to have Flash's surfaceview fullscreen instead of the flash being displayed over top of the webview view) is by touching the screen with two fingers until an interface pops up at the top of the screen, and doesn't happen reliably.

For focus, inside my webview class I call:

@Override 
protected boolean drawChild (Canvas canvas, View child, long drawingTime) {

    if (child.getClass().getName().equals("com.adobe.flashplayer.FlashPaintSurface")) {
        child.requestFocus();
    }
    return super.drawChild(canvas, child, drawingTime);
}

This doesn't set the focus as I thought it would. Although I assume, if fullscreened properly, the FlashPaintSurface should give itself focus. But if the first part is not doable, I would wonder at least to not have to give focus to the SWF by clicking on it on startup.

Please note I am doing this dynamically, not calling my own SWFs that I make myself, so I cannot solve this with Actionscript.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
corey
  • 498
  • 3
  • 10
  • ive found the solution to the focus problem was to add onload="document.OBJECTID.focus();" into the HTML and id="OBJECTID" name="OBJECTID" into the , however i still cant invoke the method properly. – corey Apr 15 '11 at 23:23
  • 1
    I am not sure this is possible, when you run a swf in a browser, you can usually only go fullscreen from a user event, like touch or click with mouse. Its for security. If the app was run in adobe air you can go fullscreen without user interaction. – Neil Jun 06 '11 at 14:12

2 Answers2

0

Every Android App By Adobe uses a file "application.xml" -- by default as its Descriptor:

Take a look at that file before you write any code for this. It changes every revision, but the last time I used it was to set this variable (Full_screen)..

0

I have had success this using the code on my previous solution to Problem to load flv video in webview. It may be of some help.

The embed tag looks like this:

<embed
 style="width:100%; height:100%"
 src="./FLVPlayer.swf?fullscreen=true&video=./expression_sad.flv"
 autoplay="true"
 quality="high"
 bgcolor="#000000"
 name="VideoPlayer"
 align="middle"
 allowScriptAccess="*"
 allowFullScreen="true"
 type="application/x-shockwave-flash"
 pluginspage="http://www.macromedia.com/go/getflashplayer">
 </embed>
Community
  • 1
  • 1
Moog
  • 10,193
  • 2
  • 40
  • 66