DIGG API Example using AS3
The DIGG API for AS3 is set up for use in Flex, not the Flash CS3 IDE (which seems to be a bad trend). Even though you can make it work without Flex, it’s not exactly straight forward. It also does not include any examples to help a developer get started. Unlike the AS2 version of the API, which includes three semi-useful examples.
In my quest to become Actionscript 3.0 / OOP proficient I put together this simple example using the DIGG API to pull the last 10 popular stories. Right now it’s only using the TextField to display and handle the events so there is no useHandCursor option unless you attach it to a Sprite or SimpleButton. But I added a rollover color and these are linked to the articles on DIGG.
Flash Content
Note: The source code includes the entire set of Flex 2 classes, as the Digg API requires it and I wasn’t sure how to strip out the unused classes. I wanted to include everything necessary to publish from the Flash IDE.
January 29th, 2008 at 4:34 pm
Funny you used my post about the bias to flex and yet I made a flash CS3 apt that works with the RSS of digg found here.
http://gfxcomplex.com/blog/game/play-hang-man-with-diggcom-digg-man/
I think the strange thing about Flex API’s is that there is no reasoning for it. All the api’s that I have seen that are flex only could be used in flash if the as3 did not use flex only classes to do rare and abstract things that could be done other ways. After all the digg’s api should only be handling data so why flex only?
I just said to hell with there API and use their RSS to do the same thing.
January 29th, 2008 at 4:43 pm
Yeah, I’ve thought about just using the RSS feeds for other API’s like Twitter also, but you miss out on functionality like authentication. I wonder if there are any other benefits to using the API over the RSS feeds?
January 29th, 2008 at 5:56 pm
Hi Paul,
The flex directory of the Digg FDK source repository just isn’t named very appropriately. Everything in there is pure AS3—no Flex components or otherwise Flex-specific code. Just include flex/source/ in your source path, and you’re good to go.
That said, the lack of documentation is a pretty serious problem. Sorry about that.
January 29th, 2008 at 10:20 pm
Shawn, without the Flex2 SDK in the classpath, I get the following error:
Comment.as, Line 32 - 1120: Access of undefined property StringUtil.
Then even when I add the single StringUtil.as file to my proper local classpath, I get additional errors. The only way I can compile without errors is to include the Flex2 SDK. Though it would be nice if that wasn’t the case.
February 5th, 2008 at 1:07 pm
Whoops, sorry about that! I’ve removed the StringUtil reference, so it should work fine now.
February 26th, 2008 at 7:29 am
so it’s safe to say that the Digg API is pure AS3 now and not dependent on any one Framework?
If so thanks.