Success Window fix in Facebook ActionScript API

Facebook ActionScript APII just added a fix to an issue with the Facebook ActionScript API I ran into where after logging into Facebook on Android, the success event listener would never get called, the login window would never disappear, and you’d be left with a white StageWebView window with the word “Success” in it. It had something to do with a change in how AIR for Mobile handles StageWebView events.

I also noticed that when you would pass in a custom viewport for StageWebView in the initial window, the code would overwrite any settings and make it full screen. I didn’t think that was the expected behavior so I patched some code in FacebookMobile to make sure that if the login function has a viewPort specified, that one gets used instead of creating a new one.

I’m working on getting it added to the release SWC but I can’t tell exactly how the project has that process set up, so for now if you want the fix you’ll have to check out the source directly.

I’m spending some time with the Facebook API recently so if you have any issues, let me know.

A Couple of PlayBook-Related Videos on AdobeTV

The PlayBook is on sale today and it really is a beautiful device, especially for Flash developers. Having been able to play with one for a while now I am incredibly impressed with the QNX operating system and the general form factor of the tablet.

I did a couple of videos on the PlayBook for AdobeTV. The first one is on using OAuth with the PlayBook. It should be a good primer for PlayBook developers who want to leverage services like Twitter or Facebook Connect. The second one was a video of one of Renaun’s tips on how to use ImageCache in a QNX list to help improve performance. Both are embedded below.

Using Swipe Events with the BlackBerry PlayBook

The BlackBerry PlayBook SDK and Simulator support a couple of different swipe events along the top of the device. I recorded a quick screencast that talks about a couple of different ways you can use the events in your own application.

You can grab the example code here in Snipplr.

ActionScript/Flash/Flex Library for Geonames

I’m working on a mobile application demo that relies heavily on the Geonames service and in the process started work on an ActionScript library for accessing the web service that you can find on Github. If you aren’t familiar with Geonames it’s a fantastic project. It’s a database of placenames from all over the world (over 8 million) and each has a bunch of data (including latitude and longitude) about it. The database includes everything from physical features like mountains to schools and parks in cities. And it’s all free.

The API is really basic right now and it only implements the findNearby method but hopefully it’s a start. And I want to round it out as I start to use it for more demos. It’s a really amazing amount of data.

Example Added for GpxAs3 – The Flash/Flex GPX Library

Last week I added an example file to the GPX library that Simeon and I created for Flex/Flash/AIR applications. If you haven’t seen it and are interested in checking it out you can grab the code from the project page on GitHub.

The example provided is a very, very basic one that just takes a GPX file and plots the waypoints on Google Maps. It’s an AIR application so to use it you just drag and drop the GPX file onto the app. The code is here.

I haven’t been able to do anything cool with it yet, but I have some things in mind once I get a bit of downtime. If you’re using it, I’d love to hear about it.

Getting Code Completion on Custom Events in Flex with the Event Metadata Tag

I was working on an application today and noticed that one of my classes wasn’t giving me code completion on the events when I called the addEventListener method. The reason is pretty simple but I figured blogging it would help keep it in my mind. Plus, I’ve never been as solid on the metadata tags in Flex as I should be.

In order to create the custom event I created a class which extends EventDispatcher. This allows me to call the dispatchEvent method for the class and bubble that up to the application. So I create a new variable and instantiate it with the constructor, add an event listener for my custom event, then call the method which ultimately dispatches the event:

var str:String = fr.data.readUTFBytes(fr.size);
var xml:XML = new XML(str);
gpx.addEventListener(ParseEvent.PARSE_COMPLETE,onGpxParseComplete);
gpx.load(xml);

That’s pretty standard. But when I typed addEventListener and went to create a method to handle the event, I just got the default events for the EventDispatcher class, activate and deactivate.

In order to get code completion, you have to add the Event metadata tag to the class that is extending EventDispatcher. The Event metadata tag takes two parameters, the name and type. The name attribute just refers to the name of the event, in my case, the value of my static const. Type is the name of the event class. So for my ParseEvent with a PARSE_COMPLETE event name, I just add the following metadata to the class that extends EventDispatcher:

[Event(name="parseComplete", type="com.adobe.gpslib.gpx.events.ParseEvent")]

Metadata is a powerful part of the Flex framework and is something well worth looking into.

ActionScript GPX Library Updated

Simeon and I (mostly him) have been doing some work on our gpxas3 library, which lets you read and write GPX files from GPS devices. I haven’t really talked about it at all but I’m starting to use it in some of my demo projects and Simeon just checked in some changes to the trunk so I thought I’d do a quick blog post.

The library supports both GPX 1.1 and GPX 1.0 and has support for synchronous parsing of files as well as asynchronous parsing. I’m pretty sure most of the GPX generator code works but I haven’t tested it recently so there may be some bugs. On the todo list is to clean it up so I can generate decent ASDocs for it and get extensions ironed out.

ProgrammableWeb Hits 1,000 Web APIs and Some ActionScript Cloud APIs

ProgrammableWeb is one of my favorite sites. If you haven’t been there, it’s an aggregation of all the various APIs that exist. Everything from Twitter’s API to an API from the USGS that gives you elevation of a point based on latitude and longitude (they even had APIs for the On AIR Bus). So I was happy to see that they recently hit 1,000 Web APIs. That’s good for the web and good for developers.

For those of you on the ActionScript side of things, Ted has been putting together a list of ActionScript Cloud APIs. It’s not close to the 1,000 that ProgrammableWeb has, but that list of ActionScript libraries will get you started using some of the many APIs that ProgrammableWeb has. If you know of some that aren’t on that list, make sure to leave a comment at the bottom of the page.

LINQ for ActionScript

G-uniX has a post up about a project he’s been working on to bring LINQ-like functionality to ActionScript. He’s been doing a lot of C# work and was really digging how LINQ works.

LINQ is a pretty cool concept that I don’t totally understand all of the nuances for. It essentially makes it really easy to get bits of data. G-uniX’s code sample illustrates it pretty well. You can use SQL-like syntax on an Array or any other data structure:


private var q:GAIQL = new GAIQL()
private var result:Array = q.Call("FROM myarray GET thevalueiwant" ,this);

This would be great to have for AS3 so if you're interested in the project, let him know and he should let you in on the early bits.