You are here: Docs Technical Documentation Configuring Widgets Configurable Widgets: Flash

Configurable Widgets: Flash

See the configuration overview for information on the overall widget configuration mechanism.

When your Flash widget is loaded by the Clearspring platform, it will receive any configured widget parameters as URL parameters and as FlashVars.  That is, arguments are attached to your primary source URL using standard URL-encoding, and, as is standard with parameterized SWF URLs in the Flash runtime, these arguments are also made available directly to your actual widget code.

Overview of Configurable Flash

Never used configuration with Flash, or don't understand what FlashVars really are?

In general, Flashvars can be passed either as HTTP GET parameters (after the filename--e.g., "widget.swf?variable=value") or as a special attribute of the embed/object tag called flashvars.  Either way, they will be provided to the Flash movie at run-time . And by using the URL method, the variables are also available to your server where the SWF is actually served (should you need them server-side).

Here's a simple example. Let's say your Flash movie has a Text Field on the Stage called "myTextField". We want to set the field's contents dynamically by concatenating the values of three variables together.

First, inside your Flash movie, you'd have ActionScript like this:

var myVar1:String;
var myVar2:String;
var myVar3:String;
var concatVariables:String = myVar1 + myVar2 + myVar3;

myTextField.text = concatVariables;

// Output to text field will be:
// OneTwoThree

After publishing this SWF as "myflashvars.swf", we could create this HTML snippet to load it:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
width="550" height="400" id="myflashvars" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="myflashvars.swf" />
<param name="flashvars" value="myVar1=One&myVar2=Two&myVar3=Three">
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="myflashvars.swf"
flashvars="myVar1=One&myVar2=Two&myVar3=Three" quality="high"
bgcolor="#ffffff" width="550" height="400" name="myflashvars"
align="middle" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer" />
</object>

Loading this snippet in a modern browser would show the text field populated with "OneTwoThree", as the Flash runtime will provide the variables set with flashvars into your Flash app.  We used flashvars in this example, but as far as your widget is concerned, it's the same as if they were passed on the URL.  All of this is standard Flash behavior, nothing specific to Clearspring.

The Clearspring Approach

Launchpad In-Widget uses the same idea to pass parameters through to the contained widget, for any parameters registered in the Widget Console.  These parameters will be passed to your SWF URL, and made available within your movie in the standard way.

We've already discussed the benefits of having this configuration managed centrally by our servers, but from within your actual widget you don't likely care -- you can simply access these parameters by parsing the incoming URL arguments on the server, or just referencing the variables in your Flash movie, as you normally would.

Note: Any URL parameters that are already included in the source URL you specify for your widget will be parsed and registered as Parameters within the platform.

Overriding Parameters

Another powerful platform feature is that you can override parameters for individual widget placements, if you need to, as described in Overriding Parameters.