Class: FlashBridge


JavaScript bridge class that communicates with the corresponding ActionScript side within the Flash application. Used to bind the HTML object containing the Flash movie to the LightstreamerClient in order to dispatch updates to Flash-side subscribed items.

new FlashBridge(objName, lsClient, onBridgeReadyCallbackopt)

Creates a bridge object to be used to enable communication with a Flash movie located on an html page. This object enables the Flash movie to receive data through a Lightstreamer connection. Each FlashBridge is related to a single Flash movie. It is possible to declare more FlashBridge instances. Each instance needs a LightstreamerClient instance to work correctly; the same LightstreamerClient can be used to feed several FlashBridge instances.
Note that a Flash object will be allowed to operate only after the onload event of the html page hosting this Flash object has been executed. Also note that the LightstreamerClient has to be connected to a Lightstreamer Server before it can forward subscription requests and pass data to the Flash object.
Name Type Argument Description
objName String A string equals to the HTML "id" attribute of the object tag, containing the movie, and equals to the name attribute of the embed tag of the same movie. This name must be passed to the JavaScriptBridge constructor on the Flash side. In case the swfobject JavaScript library is used to create the Flash object the "id" can be specified in the attributes parameter; for instance:

swfobject.embedSWF("mymovie.swf", id, width, height, version, expressInstallSwfurl, flashvars, params, {id: "flashObject"}, function() {
  var flashHandler = new FlashBridge("flashObject", myLSClient);

Note that the id that is the second parameter of the embedSWF method is not related with the id needed by the FlashBridge.
lsClient LightstreamerClient the client instance that will feed the FlashBridge. It is not needed for the LightstreamerClient to be already connected when the FlashBridge is created.
onBridgeReadyCallback function <optional>
event handler that is called as soon as both the Flash movie and the FlashBridge objects are ready. This event will be fired, with no arguments, only after the onload event of the page containing the code has been executed. Specifying a handler is optional.
if no LightstreamerClient is passed.

Method Summary

Inquiry method that gets the Flash movie object reference related to this FlashBridge instance.

Method Detail

getFlashObject() → {Object}

Inquiry method that gets the Flash movie object reference related to this FlashBridge instance.
A pointer to the Flash movie object or null if that object is not yet available or can't be reached.