Developers > Learning Center > New Widget Tutorail
Steps to build a New Widget using the wAPI and publish into the yourminis widget platform:
Download wAPI, un-zip, and double-click the widget.mxp to launch the adobe extension manager.
If you don't have Flash CS3 or you are unable to install the .mxp for whatever reason, not to worry... You can still add the dynamic wAPI calls and compile your widget without this download. However, you will have to upload in order to test your widget.
Create a new flash file for your widget content.
This
panel allows you to click a button within the IDE to TEST your widget. Open up the
Widget Panel under Window -> Other Panels -> Widget Panel as shown:
You can move this panel and size it to your liking, and when you are ready, simply click the "LAUNCH" button to test out your widget locally before uploading to the yourminis widget platform.
Read
the wAPI Reference within the Flash Help Panel to get the details on the wAPI code
you'd like to add. You can also view the wAPI Reference online.
The yourminis.api.Widget class is the main class that provides an ActionScript 3.0 API to the yourminis Widget Platform. All wAPI widgets will have a "widget" variable of type yourminis.api.Widget automatically set before the onWidgetLoaded event within the top level DisplayObject.
Minimal Widget API Flash code
Minimal Widget API Flex code:
Here is a list of some common wAPI actions to be aware of:
- HTTP/REST Requests - If you need to make HTTP requests to 3rd party servers, check out the HTTPLoader
- Myspace URL clicks / tracking - If you are interested in enabling URL click tracking and supporting myspace URL clicks, replace any of your calls to "navigateToURL(URLRequest)" with "widget.navigateToURL( URLRequest, [[target=_blank], [track=true]])"
- RSS Proxy, Conversion, and Caching - The RSSLoader convert ATOM and RSS feeds to RSS 2.0, convents xml encoding to UTF-8 and implements caching for faster loading.
- Background / Coloring - If you want to quickly enable the crisp looking, standard yourminis widget backgrounds with user configurable color picker, check out the widget.chrome property.
- Targeting - You may want to target content in the widget based on geolocation or other user information. Check out widget.reporting.getTrackingData()
- Custom tracking - You may want to start tracking and reporting on some custom user action such as video tag searches or foobar requests. If so, check out widget.reporting.trackCustom(...)
Code
Hints - If you forget the wAPI call, the automatic code-hints should help
you. All of the classes with the wAPI and instance properties of the Widget class
will display codehints within the Flash IDE as you type.
If your widget variable name ends in *widget, the code-hints will be enabled for the object. All wAPI widgets will have a "widget" variable automatically set before the onWidgetLoaded event within the top level DisplayObject. If you want to use your own variable, be sure to assign your variable on the onWidgetLoaded event
When you are ready to test, simply click the button "Test this widget!" in the Widget Panel to test out your widget locally before uploading to the yourminis widget platform. Also, you can sign in now to test your widget on our Online Test Console.
This will give you a good idea of what the widget will look like once it's uploaded and copied to other destinations.
This screenshot below is based off the RSS Widget Sample in the Samples.zip
Publish your widget: In this step, you will select a name, upload your .swf and thumbnail files, enter in details about your widget, then click publish. After you click "Publish", Click "Return to Previous Page" to get back to these instructions.
You can now see your widget in the dashboard. Use the dashboard to view reports and manage your widget configurations and access restrictions.
yourminis