as3Query – Actionscript Port of jQuery

This is older, from january, somehow I missed it but… nitoyon has created an AS3 port of jQuery. jQuery is my favorite javascript tool besides javascript itself. Mootools, prototype, and others like mochikit are all great but jQuery was the first to do lambda chain decorating and others followed suit.

But having this power in as3 is a great thing! $ selectors, common access methods to properties, methods, etc. All good stuff. Again this shows the fun in as3 or ES4 based languages like Actionscript because people are porting all sorts of libraries to it. If this performs I may just start using it daily TODAY!

For instance setting the stage align for use in full screen:

$(stage).attr({scaleMode: "noScale", align: "TL"});

That is too fun… The only thing not cool about this is all the spam at nitoyon‘s blog : )

How about a functional Tweener call:

function animate(f:Boolean):void {
				// Select 'RoundRect' elements using CSS selector
				$("RoundRect:" + (f ? "odd" : "even"))
						rotation: 90,
						scaleX: 0.5,
						scaleY: 0.5,
						time: 0.6,
						delay: 0.3,
						transition: "easeOutCubic"
						scaleX: 1,
						scaleY: 1,
						time: 0.5,
						delay: 0.9,
						transition: "easeOutElastic",
						onComplete: function():void {
							// restore the rotation and call again.
							this.rotation = 0;

Stuff to see and try

8 Responses to “as3Query – Actionscript Port of jQuery”

  1. mario gonzalez Says:

    Hmm, and mind you this is NOT sarcastic at all, but could you explain the point of this library a bit more?

    It’s a classic case of, “Well i’ve been without it for so long, i need some convincing to see why i should use this instead of just doing it the old way”

    I had to have the same explained to me when my co-worker told me about classes a long time ago. Can you maybe create a few more examples, of timesaving that would be gained by using this?

    mario -at-

  2. drawk Says:

    Hey mario,

    Yeh I can do some more samples I am using it in a flex project right now. Basically it just allows a jQuery like interface in actionscript, your familiar with jQuery for javascript?

    Although this goes against static typing it is a bit more dynamic or functional languages based. jQuery is based on a lambda output that always returns another jQuery object. People big in formal programming (math based) dig this type of structure. jQuery is really fast to chain events and the same can be done with as3query. It also provides a selector $() function that is like prototype, jquery, mootools for javascript. It might make people who only do ajax with jquery or the others more at home in AS3 and bring in more programmers/coders into as3.

    I dont’ know the performance impact but will have more on this and some samples from this flex project when completed. The jist of it is it takes static properties and methods and makes them available in dynamic objects much like popular tweening syntaxes or object based calls.

  3. onedayitwillmake Says:

    Alright cool makes sense. i’ll force myself to use it on a few things, to get the hang of it.

  4. Brit Says:

    Somehow I missed this too ! Thanks for bringing it to my attention. The SVN doesn’t seem to working for me, have the same problem?

  5. Darksaint Says:

    I’m having the same problem with the svn. When I try to connect I get an error “301 moved permanently”. That’s a bit sad.

  6. drawk Says:

    Looks like it is still up you can browse it here, there are only a few classes you can grab then from there. I didn’t have a problem with the SVN maybe something was up for a bit.

  7. chrismarx Says:

    does anyone have or know of a place with examples of using the as3query library in conjunction with an mxml page? i would like an example that maybe has some mxml elements, and shows jquery like event binding-

  8. CSS selectors for AS3 - Studio moh Says:

    […] It looks like someone has ported the $-style traversing to AS3. Finally! This entry was written by Dylan Hafertepen, posted on August 18, 2008 at 10:19 am, […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: