jQuery.post() for AS3

jQuery.post() for AS3

I don’t partake of the Adobe Flash AS3 code bubbler very much any more, having saddled up with Objective-C and iOS/OS X development a lot more these days.

However, I do dabble in AS3 from time to time, generating some prototypes and simulations with it still. AS3 has been around for quite a number of years now and it does have it’s good points. It’s usually quite quick to roll something up quickly in regards to some kind of data visualization, audio/video manipulation, etc.

I just found (it’s already over three years old) a neat Class that simplifies AS3’s URLRequest class… making the loading of images, SWFs, sounds, downloading files, uploading files, and making web service calls a snap.

Head on over to http://code.google.com/p/quiero/ and check it out. Look what it can do below just for an idea.

Go from this

var request:URLRequest = new URLRequest('http://google.com/ig/api');
var loader:URLLoader = new URLLoader();
var variables:URLVariables = new URLVariables();
variables.weather = 'Salem, OR';
request.method = URLRequestMethod.GET;
loader.addEventListener(Event.COMPLETE,onRequestComplete);
loader.load(request);

function onRequestComplete(e:Event):void
{
  trace(e.target.data)
}

To this

import quiero.*
Quiero.request({url:'http://google.com/ig/api',method:'get',data:{weather:'Salem, OR'},onComplete:onRequestComplete})

function onRequestComplete(e:RequesterEvent):void
{
  trace(e.data)
}

Update: Google shut the door on this query, I tried out Yahoo! and it works fine, you just need to deal with a namespace.

4 Comments on “jQuery.post() for AS3

  1. Nasty. Removes all those nicely typed AS3 values with code hinting with a generic untyped object much akin to AS1.

  2. It’s true that you don’t get the typing or hinting, but if you’re the sole developer on a smaller project/simulation/prototype it’s a lot more straightforward.

    Being verbose on a team & keeping things typed and clear is a benefit of going the straight URLRequest route, but stuff like this has it’s place too.

  3. 10 years later I’m still unable to remember TweenLite parameter syntax. This would drive me through the same mental pain.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.