One of the most fun inventions of my lifetime is the Mini. - James Dyson
Over the past couple of weeks Mark Blomsma and Joe Tulloch have discussed the Goowy desktop and yourminis widget API. Over my next few blog postings I’d like to dig into the process of developing your own widgets with the yourminis API, so let’s get started!
Development Requirements
The yourminis widget API (wAPI) is an Actionscript library that allows current Adobe Flash developers to quickly turn their existing content into widgets. While the wAPI is supported under Actionscript 2.0, Actionscript 3.0 is recommended. It is possible to develop widgets using third-party Flash tools, it is recommended that you begin with Adobe Flash CS3.
Getting Stared
One of the very first things you’ll want to do is create at the yourminis site. Visit http://www.yourminis.com and click on the sign up link in the upper left. (Attention Mac users, I had some issues with the sign up process while using the Safari 3.0 browser, I switched to Firefox and had no problems.)
The next step is to download and install the wAPI Flash extension. You can download the wAPI here. Double click on the .mxp file that is extracted to automatically install the extension. As shown in Figure 1, the Adobe Extension Manager should ask you to confirm the installation. Click Accept to continue. Close and restart Adobe Flash CS3.
Figure 1. Adobe Extension Manager confirmation.
Creating Your First Widget
Begin by creating a new Flash file. You’ll want to enable the widget test panel – this will allow you to test your widgets in the Adobe Flash CS3 development environment. You can do this by going to the Window, Other Panels, Widget Test Panel menu items.
Now you’re ready to create your first widget. I’ll explore the wAPI in more detail in coming posts, so for now here’s some basic code to create a standard Hello World application. Go to the Actions window (click on Window, Actions if it isn’t displayed), then cut and paste the following code:
//This is the minimal code necessary to initialize
// and hook into the widget API (wAPI)
var widget; //Widget
addEventListener("widget-loaded",onWidgetLoaded);
function onWidgetLoaded(evt:Event)
{
//init widget will enable and set the chrome dimensions and background color
widget.initWidget(300,300,0xffffff);
//add the textfield to the form
var textfield:TextField = new TextField();
textfield.text = "HELLO WORLD";
textfield.x = 100;
textfield.y = 100;
addChild(textfield);
}
You can further explore the wAPI from the Actions window, as shown in Figure 2. You’re now ready to test your application – click on the Launch button in the Widget Test Panel, as shown in Figure 3. Congratulations – you just created your first yourmini widget!
Figure 2. Actions Window.
Figure 3. Test your widget!
Resources
I’ll continue to explore the wAPI in my upcoming blogs, until then here are a few links to help you start exploring further:
- wAPI Documentation - http://www.yourminis.com/developers/docs/as3/index.html
- Widget Test Console - http://www.yourminis.com/developers/test/index.aspx
