Jun 4 2008

AIR+OpenAIM: Buddy List Viewer

John C. Bland II

I’m researching OpenAIM for an upcoming article and thought I’d share a few quick tidbits about connecting to OpenAIM. Let me first say…I didn’t do anything special here. AOL has provided a pretty quality developer center and they have written the ActionScript 3 code necessary for connecting to the AIM service. As a test I thought I’d try to grab my buddy list and show it in an mx:Tree component.

Disclaimer: This is purely a sample app so the code does not use any best practices or anything…just showing how to use the OpenAIM code.

Sample AIR app:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:wim="com.aol.api.wim.*"
                        layout="absolute"
                        applicationComplete="init()">
    <mx:Script>
        <![CDATA[
            import com.aol.api.wim.data.types.SessionState;
            import com.aol.api.wim.data.User;
            import com.aol.api.wim.data.Group;
            import com.aol.api.wim.Session;
            import com.aol.api.wim.data.BuddyList;
            import com.aol.api.wim.events.BuddyListEvent;
            import com.aol.api.wim.events.SessionEvent;
            private var aolSession:Session = new Session(stage, "your developer key", "Your Test Client", ".1");
            private var aolBuddyList:BuddyList;
            private function init():void{
                aolSession.addEventListener(SessionEvent.SESSION_STARTING, handleSessionStarting);
                aolSession.addEventListener(BuddyListEvent.LIST_RECEIVED, handleBuddyListLoad);
                aolSession.signOn("your username", "your password");
            }
            private function handleSessionStarting(event:SessionEvent):void{
                aolSession.requestBuddyList();
            }
            private function handleBuddyListLoad(event:BuddyListEvent):void{
                aolBuddyList = event.buddyList;
                updateBuddyList();
            }
            private function updateBuddyList():void{
                var buddyList:XML = <node label="AOL Buddy List" />
                var group:XML;
                var user:XML;
                for each(var item:Group in aolBuddyList.groups){
                    group = <node />
                    group.@label = item.label;
                    for each(var userItem:User in item.users){
                        if(userItem.state == SessionState.OFFLINE) continue;
                        user = <node />
                        user.@label = userItem.aimId;
                        group.appendChild(user);
                    }
                    buddyList.appendChild(group);
                }
                buddies.dataProvider = buddyList;
            }
        ]]>
    </mx:Script>
    <mx:Tree id="buddies" width="100%" height="100%" showRoot="false" labelField="@label" />
</mx:WindowedApplication>

So, briefly I’ll cover the code (gotta cook dinner in a sec; lol). On Line 4, above, we set the applicationComplete event to call our init() function, lines 19 to 23. In there we add a couple event listeners then call the signOn(..) function of the WIM api. Before we can successfully do this the aolSession variable must be created, which we do on line 15.

Note: You HAVE to get a developer key from AOL in order to test this code.

Once the sign on request is complete we call requestBuddyList(), line 26. When the buddy list is returned we set the aolBuddlyList variable then call updateBuddyList(), line 32. The updateBuddyList() function merely loops over the groups (your buddy groups) and users in each group, updates the buddyList XML local variable, then assigns it to the dataProvider of the buddies Tree component.

For the UI we mer
ely create an instance of mx:Tree and set the labelField to @label, which is what we created in the updateBuddyList() function.

That’s it. Run the app and you’ll see your buddy list in a window like below:

MyBuddyList

They have some work to do on the source code but I went from from 0 knowledge to this sample app in 20 or so minutes. Grab the code and check it out.


Dec 13 2007

Flex 3 and AIR – Beta 3 on Labs

John C. Bland II

That’s right, check it out and get your Flex on while you grab some AIR! Ok…cliche…I know, or is it? :-)

Anyways…”grab the beta versions on Adobe Labs”:http://labs.adobe.com/.

I can tell you…this is very important release. Check the release notes to see all of the new stuff.


Nov 11 2007

CF AIR Compiler

John C. Bland II

Terrence Ryan has a proof of concept app (“CF AIR Compiler”:http://www.numtopia.com/terry/blog/archives/2007/11/cf_air_compiler.cfm) which takes CF sites and compiles them into AIR apps. His approach simply makes since and CF is probably the easiest language to accomplish this since CFHTTP and CFFILE are so freaking simple to use.

Although this is done with CF, for CF, and by CF (I only…with and by are the same thing but i had to complete the phrase; hehe) you could essentially point this to almost any site and pull the files (html content, js, and css) but it is cool to see this proof of concept in the wild.


Sep 17 2007

Multidmedia Zinc vs Adobe AIR

John C. Bland II

Multidmedia wrote an article in April of this year titled “Zinc Vs Apollo: The Good, The Bad and The Desktop”:http://www.multidmedia.com/support/developers/articles/?action=show&id=33. It is written with a bit of a defensive tone, understandably. Their whole business is Zinc. I mean, they have other products but Zinc is definitely the big one and Adobe AIR is SERIOUSLY going to cut into profits for them. It is free compared to several hundred for Zinc. Anyways…I wanted to clarify a few things from their article.

They did write this in April of this year so the info was current as of them but it isn’t now. For instance, the table at the bottom compares Zinc and AIR. This is the biggest “gripe” I have with the article.

(see the article first then the rest of this post will make sense)

Continue reading


Sep 15 2007

Aptana IDE+Adobe AIR is SWEET!

John C. Bland II

Ok, this is my first impression and, as with all things, I’m sure I’ll find something wrong with it but right now…NOPE…IT ROCKS!

You can build “HTML+Javascript AIR applications”:http://labs.adobe.com/technologies/air/develop_ajax.html! I love it, again…at first glance. The more I play with it I’ll expand my thoughts but at this point this is about all I can say. lol. :-)

Oh, it is also useful for normal Javascript, Apple iPhone development, and more. Last note…it is free! :-D


  • Get Adobe Flash playerPlugin by wpburn.com wordpress themes