Displaying Flash Content

Advance preparation

Mobage Open Platform offers a convenient API for displaying Flash content. In order to use this API, it is necessary to prepare the application’s Gadget XML as follows to enable this feature.

Displaying Flash content

The following contains sample code for displaying Flash content in an application:

  • By calling gadgets.flash.embededFlash(), generate and display the HTML to embed Flash content.
  • Arguments are as follows:
    • URL of the Flash content
    • DOM element where the Flash content will be embedded
    • The minimum version of Flash Player required for the Flash content to be displayed
    • Parameters to be specified as Flash content

Please specify the string type for the parameter value.


The Mobage Open Platform has some APIs that require an overlay, such as friend invitation (requestShareApp), creating a diary (requestCreateDiary) and purchase of an item (requestPayment). On calling such APIs, a Flash content may appear on top of these pop-ups and thus you may not be able to operate the window behind it.

To avoid the problem, specify the value of “wmode” which is a parameter specified in the fourth argument of gadgets.flash.embedFlash, as “opaque” or “transparent” as described in the aforementioned examples. If not specified, wmode=”opaque” is used as a default value.

Depending on a browser type and a Flash version, the problem may not be resolved by the aforementioned solution, and another problem may occur. You cannot enter double-byte characters in the Flash content.

To avoid such incidents, we recommend you to hide a Flash content temporarily before it overlays, and show the Flash content again later in the callback function called when the overlay closes.

An example of showing and hiding a Flash content

 An example of hiding and showing a Flash content are shown below.

Specifying id by gadgets.flash.embedFlash

Specify “id” with a parameter of the fourth argument of gadgets.flash.embedFlash, to be able to obtain a Flash object later with getElementById(). In this example, “swfElement” is specified as id. There are different ways to embed Flash to DOM, between Internet Explorer and other web browsers, for gadgets.flash.embedFlash. By specifying id in this way, you can obtain a Flash object from JavaScript, no matter how the Flash was embedded.

How to show/hide Flash

There are some ways to show and hide Flash in time with opening and closing of an overlay. In this section, we take an easy way: show and hide Flash by changing a visibility property of Element from JavaScript.

The following function can be considered as one example:


You can hide Flash by configuring visibility as “hidden” at hideFlash, and show it again by configuring visibility as “visible” at showFlash. 

How to sync opening and closing of an ovelay with hiding and showing Flash

The following shows how to hide and show Flash in sync with opening and closing of an overlay that is displayed in requestPayment, etc., by using API of mbga.util and below. When you use mbga.util API, specify <Require feature=”mbga” /> in Gadget XML in the same way as other mbga API.



By using mbga.util.registerOpenOverlayHandler, you can hook an API call that shows an overlay such as requestShareApp and requestPayment, and you can specify what to do each time before showing an overlay. Furthermore, you can specify what to do each time, when a user click “x (close)” button at the right top of an overlay, by using mbga.utilregisterCloseOverlayHandler.


Please refer to the documents for the APIs of mbga.util and below.

Revision History

  • 10/2015
    • Switching between showing and hiding of Flash was added.
  • 12/2010
    • Initial Release.


Make Request to external servers


Setting the Display Range