Sample Banner Widget

From Chumby Wiki
Jump to: navigation, search


FLA source files (requires Flash MX or later): simplebanner.fla, simplebanner_config.fla

This example file shows how to make a simple banner widget. It basically allows the user to specify a line of text that she wants to display on her chumby. This example shows the basics behind creating a configuration movie that will run on the website, and how to access that information from the widget.

The configuration widget essentially downloads some XML from our database and populates the form, then uploads the user's changes back to the database.

There are some routines in the example that make it easier to upload and download this XML and all you have to do is modify the properties of an object and call the right routines.

The relevant routines are:


where "receivedParameters" is a function you provide that is called when the XML for the parameters is received from the server, something like:

function receivedParameters(parameters) {
	myTextField.text = parameters.someParameterName;

After the user modifies the parameters, you call:


where "sentParameters" is a function you provide that is called when the parameters have been successfully uploaded. You then call:

_chumby_exit(); dismiss the configuration widget.

The Control Panel on the chumby takes care of setting up the variables in the widget that runs on the chumby - the variables just show up on the main timeline. You should build the widget to handle the case that the user never configured it - for instance, an unconfigured weather widget would just show some hard-coded location, or it might present a message encouraging the user to configure it.

Widgets parameters that are prefixed with "_private" are not copied when a widget is sent or forwarded by one user to another user. This is typically done for private account information such as passwords or authentication tokens.

Other examples: