Perhaps you, like me, have had a need, at some point or another, to parse RSS feeds in Actionscript. If so, then perhaps you’ve also stumbled across the generally wonderful as3syndicationlib developed by Mike Chambers and Christian Cantrell. For those of you who aren’t in the know, allow me to provide the following excerpt from the project’s google code page:

Use the syndication library to parse Atom and all versions of RSS easily. This library hides the differences between the formats so you can parse any type of feed without having to know what kind of feed it is.

These claims actually hold up pretty well…once you get the code running.

The problem is that the codebase was written specifically for development in Flex. While Flex is a great platform for certain projects, many of us still use Flash for a lot of the work we do, so a toolkit that relies on packages that are only available to Flex just doesn’t do it.

This problem is also no secret. It’s listed as an accepted issue on its project page. The problem is that the codebase apparently hasn’t been updated since December of 2006.  That’s no joke kids.

Fortunately, a solution was pushed forth from outside the project by a Mr. Martin Legris in the form of a bare implementation of the missing “DateBase” class that the syndication library looks for, as well as an edit to an import statement buried down in ParsingTools.as.

So if you, like me, have a need to consume RSS/Atom Feeds in Flash and need a solution that works, look no further. I present, to you, an updated version of the as3 syndication library with the necessary changes in place to begin using it out of the box in your flash projects.

The files are all available here.

Categories: ArticleBugsDownloadsFlashLibrariesas3syndicationlib
Published: 07.02.10 :: No Comments »


Earlier today I posted about a strange bug I was encountering while trying to parse an RSS feed of my foursquare check-ins. I posted a complaint about the issue and received a prompt reply:

bauserdotcom replied 44 minutes ago

The dates in the RSS feed aren’t wrong, technically. They’re just not formatted according to best practices.

Foursquare’s RSS feed is using 2-digit numbers for years (which is valid, but not recommended, according to the RSS 2.0 Specification). How the RSS-reading agent interprets a 2-digit year is up to the agent. Whatever software you’re using decided to interpret it as 1910, which an interesting choice, since RSS didn’t exist in 1910.

So what we have is a case of two legal-but-unwise programming approaches creating a mess. Hard to say who’s most wrong, you know?

Fair enough. This is all well and good, and if I were simply reading the items one by one I would be quite able to understand that a year of “10″ actually means 2010. The problem rears its ugly head when I try to parse these dates in Flash. Consider this selection from the constructor for Flash’s built in Date class:

yearOrTimevalue:Object — If other parameters are specified, this number represents a year (such as 1965); otherwise, it represents a time value. If the number represents a year, a value of 0 to 99 indicates 1900 through 1999; otherwise all four digits of the year must be specified. If the number represents a time value (no other parameters are specified), it is the number of milliseconds before or after 0:00:00 GMT January 1, 1970; a negative values represents a time before 0:00:00 GMT January 1, 1970, and a positive value represents a time after.

As you can see, two digit dates in the constructor for Flash’s date class are interpreted as years since 1900, not 2000. The only fix available to me is to inspect every item of the feed I’m loading (since these are being aggregated into one giant list of items) to see if the publication date is sometime in the 20th century. Great.

Of course, I’m not all sour grapes. I just posted an “idea” on Foursquare’s “Get Satisfaction” page.

Categories: ArticleBugsFoursquareSocial Media
Tags:
Published: 05.26.10 :: No Comments »


Today I was working on aggregating some RSS feeds for a project I’m working on using the wonderful (if dated) as3 syndication library when I ran into something very odd. I had just added my foursquare check in feed to the list of feeds to aggregate and was examining the dates and links for each feed item to verify that they were being sorted properly. Within a date sorted list, all of my foursquare check-ins (including ones from the last couple days) were at the bottom of the list.


Thu May 26 08:14:41 GMT-0800 1910 http://foursquare.com/venue/519340
Wed May 25 12:06:31 GMT-0800 1910 http://foursquare.com/venue/519340
Wed May 25 12:03:42 GMT-0800 1910 http://foursquare.com/venue/519340
Tue Mar 29 18:54:29 GMT-0800 1910 http://foursquare.com/venue/128782
Tue Mar 29 18:53:42 GMT-0800 1910 http://foursquare.com/venue/237966
Fri Mar 25 22:39:16 GMT-0800 1910 http://foursquare.com/venue/3540
Fri Mar 25 12:23:59 GMT-0800 1910 http://foursquare.com/venue/119722
Fri Mar 25 12:23:13 GMT-0800 1910 http://foursquare.com/venue/229509
Fri Mar 25 12:22:41 GMT-0800 1910 http://foursquare.com/venue/519340
Wed Mar 9 22:49:25 GMT-0800 1910 http://foursquare.com/venue/629305
Thu Mar 3 12:54:00 GMT-0800 1910 http://foursquare.com/venue/159429
Thu Mar 3 12:53:11 GMT-0800 1910 http://foursquare.com/venue/519340
Sat Feb 12 13:14:31 GMT-0800 1910 http://foursquare.com/venue/519340
Thu Feb 3 12:26:13 GMT-0800 1910 http://foursquare.com/venue/519340
Tue Feb 1 23:24:02 GMT-0800 1910 http://foursquare.com/venue/629305
Sat Jan 29 11:58:25 GMT-0800 1910 http://foursquare.com/venue/519340
Thu Jan 27 13:03:56 GMT-0800 1910 http://foursquare.com/venue/519340
Wed Jan 26 12:03:02 GMT-0800 1910 http://foursquare.com/venue/519340
Sun Jan 23 23:10:22 GMT-0800 1910 http://foursquare.com/venue/429251
Sun Jan 23 13:16:33 GMT-0800 1910 http://foursquare.com/venue/119650
Tue Jan 18 19:09:06 GMT-0800 1910 http://foursquare.com/venue/455620
Fri Jan 14 09:19:11 GMT-0800 1910 http://foursquare.com/venue/519340
Tue Jan 11 13:49:40 GMT-0800 1910 http://foursquare.com/venue/519340
Sat Jan 8 20:51:43 GMT-0800 1910 http://foursquare.com/venue/34011
Sat Jan 8 13:01:02 GMT-0800 1910 http://foursquare.com/venue/519340

Notice anything odd there? Why are all my foursquare feed items dated 1910? Am I really going to have to add an exception to add 100 years for any feed item from foursquare? Really? I reported the issue at Foursquare’s “Get Satisfaction” page. Maybe somebody will respond?

Categories: ArticleBugsFoursquareSocial Media
Published: :: No Comments »


Recently, while working on my portfolio, I was presented with the problem of displaying YouTube content extracted from an RSS feed in Flash. On the one hand there was the difficulty of parsing embed and object tags and extracting relevant data from the mess I was given, and on the other hand there was the problem of displaying the content itself.

YouTube provides documentation for their api, but after digging around online I was surprised to find that nobody had gone through with packaging it in a format I was willing to work with. There is an ActionScript 3 YouTube Wrapper available online, but it presumes that the Chromeless YouTube Player (http://www.youtube.com/apiplayer?version=3) you download to play videos with will be accessed using a combination of the static ExternalInterface class and external JavaScripts.

This seems, to me, to be unnecessarily complicated.

I’ve gone through the trouble of picking through the API and creating a simple class that loads a chromeless player and exposes methods you can use to manipulate it and display content from YouTube, without requiring any external javascript.

The application above is written in Actionscript 3. Basic usage is as follows:

import com.agitcraft.youtube.YouTube;
import com.agitcraft.youtube.YouTubeEvent;
_tube = new YouTube();
_tube.cueURL("http://www.youtube.com/v/-CsA1CcA4Z8", 0);
addChildAt(_tube, 0);

Each of the methods made available in the official YouTube API is available in some form or another via this set of classes. When I have a little more time I’ll follow up with official documentation and availability via google code.

Download AS3 YouTube Classes

Categories: APIDownloadsFlashUncategorized
Tags:
Published: 01.14.10 :: 6 Comments »