dojox/embed/Flash (version 1.10)

Summary

Create a wrapper object around a Flash movie; this is the DojoX equivilent to SWFObject.

Creates a wrapper object around a Flash movie. Wrapper object will insert the movie reference in node; when the browser first starts grabbing the movie, onReady will be fired; when the movie has finished loading, it will fire onLoad.

If your movie uses ExternalInterface, you should use the onLoad event to do any kind of proxy setup (see dojox.embed.Flash.proxy); this seems to be the only consistent time calling EI methods are stable (since the Flash movie will shoot several methods into the window object before EI callbacks can be used properly).

Usage

Flash(kwArgs,node);
Parameter Type Description
kwArgs Object

The various arguments that will be used to help define the Flash movie.

node DomNode

The node where the embed object will be placed

See the dojox/embed/Flash reference documentation for more information.

Examples

Example 1

Embed a flash movie in a document using the new operator, and get a reference to it.

var movie = new dojox.embed.Flash({
    path: "path/to/my/movie.swf",
    width: 400,
    height: 300
}, myWrapperNode, "testLoaded");

Example 2

Embed a flash movie in a document without using the new operator.

var movie = dojox.embed.Flash({
    path: "path/to/my/movie.swf",
    width: 400,
    height: 300,
    style: "position:absolute;top:0;left:0"
}, myWrapperNode, "testLoaded");

Property Summary

  • availableUsed as both a detection (i.e. if(dojox.embed.Flash.available){ }) and as a variable holding the major version of the player installed.
  • domNode
  • id
  • initializedWhether or not the Flash engine is available for use.
  • minimumRequired
  • minimumVersion
  • minSupportedThe minimum supported version of the Flash Player, defaults to 8.
  • movie
  • supportedWhether or not the Flash Player installed is supported by dojox.embed.
  • versionThe version of the installed Flash Player; takes the form of { major, minor, rev }.

Method Summary

  • __ie_markup__(kwArgs)
  • _destroy() Kill the movie and reset all the properties of this object.
  • _onload() Internal.
  • byId(movieName,doc) Gets Flash movie by id.
  • destroy() Public interface for destroying all the properties in this object.
  • init(kwArgs,node) Initialize (i.e. place and load) the movie based on kwArgs.
  • place(kwArgs,node)
  • proxy(obj,methods) Create the set of passed methods on the Flash object so that you can call that object directly, as opposed to having to delve into the internal movie to do this.

Event Summary

  • onError(msg)
  • onInitialize() A stub you can connect to if you are looking to fire code when the engine becomes available.
  • onLoad(movie) Stub function for you to attach to when the movie has finished downloading and is ready to be manipulated.
  • onReady(movie) Stub function for you to attach to when the movie reference is first pushed into the document.

Properties

available
Defined by: dojox/embed/Flash

Used as both a detection (i.e. if(dojox.embed.Flash.available){ }) and as a variable holding the major version of the player installed.

domNode
Defined by: dojox/embed/Flash
id
Defined by: dojox/embed/Flash
initialized
Defined by: dojox/embed/Flash

Whether or not the Flash engine is available for use.

minimumRequired
Defined by: dojox/embed/Flash
minimumVersion
Defined by: dojox/embed/Flash
minSupported
Defined by: dojox/embed/Flash

The minimum supported version of the Flash Player, defaults to 8.

movie
Defined by: dojox/embed/Flash
supported
Defined by: dojox/embed/Flash

Whether or not the Flash Player installed is supported by dojox.embed.

version
Defined by: dojox/embed/Flash

The version of the installed Flash Player; takes the form of { major, minor, rev }. To get the major version, you'd do this: var v=dojox.embed.Flash.version.major;

Methods

__ie_markup__(kwArgs)
Defined by dojox/embed/Flash
Parameter Type Description
kwArgs undefined
Returns:undefined
_destroy()
Defined by dojox/embed/Flash

Kill the movie and reset all the properties of this object.

_onload()
Defined by dojox/embed/Flash

Internal. Cleans up before calling onLoad.

byId(movieName,doc)
Defined by dojox/embed/Flash

Gets Flash movie by id.

Probably includes methods for outdated browsers, but this should catch all cases.

Parameter Type Description
movieName String

The name of the SWF

doc Object

The document, if not current window (not fully supported)

Returns:undefined | null

Examples

Example 1

var movie = dojox.embed.Flash.byId("myId");
destroy()
Defined by dojox/embed/Flash

Public interface for destroying all the properties in this object. Will also clean all proxied methods.

init(kwArgs,node)
Defined by dojox/embed/Flash

Initialize (i.e. place and load) the movie based on kwArgs.

Parameter Type Description
kwArgs Object

An object with the following properties:

  • path (String):

    The URL of the movie to embed.

  • id (String, optional):

    A unique key that will be used as the id of the created markup. If you don't provide this, a unique key will be generated.

  • width (Number, optional):

    The width of the embedded movie; the default value is 320px.

  • height (Number, optional):

    The height of the embedded movie; the default value is 240px

  • minimumVersion (Number, optional):

    The minimum targeted version of the Flash Player (defaults to 9)

  • style (String, optional):

    Any CSS style information (i.e. style="background-color:transparent") you want to define on the markup.

  • params (Object, optional):

    A set of key/value pairs that you want to define in the resultant markup.

  • vars (Object, optional):

    A set of key/value pairs that the Flash movie will interpret as FlashVars.

  • expressInstall (Boolean, optional):

    Whether or not to include any kind of expressInstall info. Default is false.

  • redirect (String, optional):

    A url to redirect the browser to if the current Flash version is not supported.

node DOMNode
Optional
place(kwArgs,node)
Defined by dojox/embed/Flash
Parameter Type Description
kwArgs undefined
node undefined
proxy(obj,methods)
Defined by dojox/embed/Flash

Create the set of passed methods on the Flash object so that you can call that object directly, as opposed to having to delve into the internal movie to do this. Intended to make working with Flash movies that use ExternalInterface much easier to use.

Parameter Type Description
obj dojox/embed/Flash
methods Array | String

Examples

Example 1

Create "setMessage" and "getMessage" methods on foo.

var foo = new Flash(args, someNode);
dojo.connect(foo, "onLoad", lang.hitch(foo, function(){
    Flash.proxy(this, [ "setMessage", "getMessage" ]);
    this.setMessage("Flash.proxy is pretty cool...");
    console.log(this.getMessage());
}));

Events

onError(msg)
Defined by: dojox/embed/Flash
Parameter Type Description
msg undefined

Examples

Example 1

Create "setMessage" and "getMessage" methods on foo.

var foo = new Flash(args, someNode);
dojo.connect(foo, "onLoad", lang.hitch(foo, function(){
    Flash.proxy(this, [ "setMessage", "getMessage" ]);
    this.setMessage("Flash.proxy is pretty cool...");
    console.log(this.getMessage());
}));
onInitialize()
Defined by: dojox/embed/Flash

A stub you can connect to if you are looking to fire code when the engine becomes available. A note: DO NOT use this event to place a movie in a document; it will usually fire before DOMContentLoaded is fired, and you will get an error. Use dojo.addOnLoad instead.

Examples

Example 1

Create "setMessage" and "getMessage" methods on foo.

var foo = new Flash(args, someNode);
dojo.connect(foo, "onLoad", lang.hitch(foo, function(){
    Flash.proxy(this, [ "setMessage", "getMessage" ]);
    this.setMessage("Flash.proxy is pretty cool...");
    console.log(this.getMessage());
}));
onLoad(movie)
Defined by: dojox/embed/Flash

Stub function for you to attach to when the movie has finished downloading and is ready to be manipulated.

Parameter Type Description
movie HTMLObject

Examples

Example 1

Create "setMessage" and "getMessage" methods on foo.

var foo = new Flash(args, someNode);
dojo.connect(foo, "onLoad", lang.hitch(foo, function(){
    Flash.proxy(this, [ "setMessage", "getMessage" ]);
    this.setMessage("Flash.proxy is pretty cool...");
    console.log(this.getMessage());
}));
onReady(movie)
Defined by: dojox/embed/Flash

Stub function for you to attach to when the movie reference is first pushed into the document.

Parameter Type Description
movie HTMLObject

Examples

Example 1

Create "setMessage" and "getMessage" methods on foo.

var foo = new Flash(args, someNode);
dojo.connect(foo, "onLoad", lang.hitch(foo, function(){
    Flash.proxy(this, [ "setMessage", "getMessage" ]);
    this.setMessage("Flash.proxy is pretty cool...");
    console.log(this.getMessage());
}));
Error in the documentation? Can’t find what you are looking for? Let us know!