AS2 Hello World Tutorial
Welcome to the obligatory "Hello, World!" tutorial. You can download the source code for this example here. In this lesson, you will learn to build the most simple of widgets using the yourminis API. Once you have completed this and the subsequent, tutorials you'll be well on your way to becoming a veritable widget master!
Requirements
- Adobe Flash 8
- yourminis API mxp (If you don't have this installed yet, follow the steps found here)
Steps
1. Create a new Document
The first step in this tutorial is to open Adobe Flash 8. This is where you will do all of your widget development. While it's still possible to develop widgets using third party tools, it's probably easiest to use the Flash IDE until you are completely comfortable with the widget creation process. Once the Flash IDE is open, create a new "Flash Document".
2. Initialize an instance of the API
In the Actions panel, (if it's not already open press F9) add the following line of code to the first frame:
var ym_api:yourminisAPI = new yourminisAPI();
This line creates a new instance of the Yourminins API object which allows you to do things like set and get data as well as receive events such as resize events. We'll go into more depth regarding the yourminis API object in later tutorials.
3. Add the text
Add a new TextField to the stage at around x:10 y:30 and enter the text, "Hello, World!". Make the Text white so that you can see it since the default widget background color is black. Since the default flash document background color is white, you might want to change the flash documents background color to black or gray so you can see the TextField.Once you've finished steps one through three, you should wind up with an environment that looks similar to the image on the left.
4. Test!
Press the "Test this mini!" button in the yourminis API Panel. This will launch the yourminis API sandbox with your widget inside. The yourminis API sandbox is where you test and debug your widgets before uploading them to yourminis.com for approval. If you've done everything correctly you should wind up with a window that looks like the one in the image on the left.
That's it. You're done! Give yourself a nice pat on the back.
Conclusion
Congratulations! You've created your first widget using the yourminis API.
Next Steps
Advanced Tutorial - This tutorial covers all of the yourminis API features. from setting default widget properties to getting and setting data from the yourminis servers.
