Difference between revisions of "Gadgets.flash (v0.8)"

From VZ Developer Wiki
Jump to: navigation, search
(Die Seite wurde neu angelegt: „<div style="float:right; margin: 0 0 10px 10px;">__TOC__</div> <span style="font-size:150%">'''gadgets.flash'''</span> Embeds Flash content in gadgets. == Metho…“)
(No difference)

Revision as of 10:03, 14 September 2009

gadgets.flash

Embeds Flash content in gadgets.

Methods

gadgets.flash.embedCachedFlash

gadgets.flash.embedCachedFlash()
Injects a cached Flash file into the DOM tree. Accepts the same parameters as gadgets.flash.embedFlash does.
Parameters
String swfUrl - SWF URL
String, Object swfContainer - The ID or object reference of an existing HTML container element.
Number swfVersion - Minimum Flash Player version required
Object opt_params - An optional object that may contain any valid HTML parameter; all attributes will be passed through to the Flash movie on creation.
Returns
Boolean - Whether the function call completes successfully

gadgets.flash.embedFlash

gadgets.flash.embedFlash()
Injects a cached Flash file into the DOM tree.
Parameters
String swfUrl - SWF URL
String, Object swfContainer - The ID or object reference of an existing HTML container element.
Number swfVersion - Minimum Flash Player version required
Object opt_params - An optional object that may contain any valid HTML parameter; all attributes will be passed through to the Flash movie on creation.
Returns
Boolean - Whether the function call completes successfully

gadgets.flash.getMajorVersion

gadgets.flash.getMajorVersion()
Detects Flash Player and its major version.
Parameters
None
Returns
Number - The major version of Flash Player or 0 if Flash is not supported

Examples

function doTrick(trick) {
  var url = "http://doc.examples.googlepages.com/Trevor-"+trick+".swf";
  outputbox = document.getElementById("outputbox");
  gadgets.flash.embedFlash(url, outputbox, 7);
  gadgets.window.adjustHeight();
};

function renderControls() {
  var handle = document.getElementById("dom_handle");
  var controls = document.createElement("div");
  controls.appendChild(getButton("sit"));
  controls.appendChild(getButton("spin"));
  controls.appendChild(getButton("down"));
  controls.appendChild(getButton("speak"));

  var outputbox = document.createElement("div");
  outputbox.id = "outputbox";
  outputbox.style.width = "200px";
  outputbox.style.height = "200px";

  handle.innerHTML = "";
  handle.appendChild(controls);
  handle.appendChild(outputbox);

  gadgets.window.adjustHeight();
};

function getButton(action) {
  var control = document.createElement("button");
  control.onclick = function() { doTrick(action); };
  control.innerHTML = action;
  return control;
};

renderControls();