Write Social Applications for Imeem in ActionScript Using Adobe Flex: Part 1

Wagz Lu
In this article, I will show you how to write a simple music application using imeem's API.

Requirements:
1. You need an account with imeem
2. You need an API key and a Secret from imeem
3. You need to download the AS3 Client Library from imeem
4. You need Adobe Flex Builder
5. You need to have some knowledge of ActionScript

Application Objective: the application will allow users to search for songs/artists, play songs, sign in and add songs to their existing playlists.

Let's get started.

If you don't have an account with imeem, go to www.imeem.com and register for an account, it's free! Once your account is created, you'll need to obtain an API key and a Secret key from the developers section www.imeem.com/developers.
To get your API key and Secret, go the developers section www.imeem.com/developers, and then click on the Create link on the top menu. On the next screen, you'll see a form that looks like this: view screen shot

Enter a name for your app, choose Music as the category, enter your contact email, leave the Developer(s) field empty, enter a description, choose "Create an application off imeem", agree to their terms and choose a picture for your app icon. Then submit your request, and you'll have your API key and Secret.
Here's a sample screen shot of what you'll see, view screen shot

Next, we will need to download "The ActionScript 3 Client Library" - which provides access to the imeem Media Platform web services as well as media playback through AS3. Still in the developers section, click on the Downloads link. Your screen will look like this: view screen shot

Click on the "Adobe ActionScript 3 Client Library" link to download the .zip file. Then unzip to a location on your drive. Make not of where you save it, we'll need the file later.
We've taken care of the first 3 requirements. Now, let's move on to requirement 4.

While Flex apps can be built using just the Flex SDK, we'll be using Flex Builder - which you download (Free Trial) from http://www.adobe.com/products/flex/. So go ahead and download the Free Trial, if you don't already have Flex. By the way, if you are an advanced user who has Eclipse, you can download the Flex Extension for Eclipse.By now, you should have Adobe Flex installed and ready to go!

Start Flex up and go to File -> Create New Flex Project (view screen shot)
Enter a name for your project, specify the project location, leave the application type as "Web application (runs in Flash Player)" and leave the Application server type as "None". Then click Next. On the next screen, click on the Library path tab. Next, click on Add SWC and browse to where you extracted the .zip file you downloaded earlier. Select the "imeem.api.swc " file from that location. Click OK. Finally, click Finish. Here's a screen shot

Now, you should be inside Flex - with your project created and ready to go! You should be looking at something like this: view screen shot

We've completed the first 4 requirements! Now, you need to wake up your AS3 skills - if they were sleeping!
Let's review what our application will do. It will allow users to:
1. search for songs/artists
2. sign in
3. add songs to existing playlists

For now, we'll tackle number 1. To allow users to search for media, we need an input textbox, a button and a control to display the results. Plus, we need to provide instructions by using labels. So our interface might look like this: view screen shot

From the Components tab (lower left) and under Controls, drag the following controls to the designer:
1) 2 Labels (for prompt/instructions)
2) 1 TextInput (to enter keywords)
3) 1 Button (to fire search)
4) 1 DataGrid (to display the results)
Position them as in above screen shot.

In the next tutorial, we'll start writing code to make the magic happen.

Published by Wagz Lu

View profile

To comment, please sign in to your Yahoo! account, or sign up for a new account.