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"))
					.addTween({
						rotation: 90,
						scaleX: 0.5,
						scaleY: 0.5,
						time: 0.6,
						delay: 0.3,
						transition: "easeOutCubic"
					})
					.addTween({
						scaleX: 1,
						scaleY: 1,
						time: 0.5,
						delay: 0.9,
						transition: "easeOutElastic",
						onComplete: function():void {
							// restore the rotation and call again.
							this.rotation = 0;
							animate(!f);
						}
					});
			}
			animate(false);

Stuff to see and try

A Peek into the AS3 and AVM2 Virtual Machine and ‘Elastic Racetrack’

AS3 Flash 3D Engine Alternativa Platform Drops A Nuke – Isometric and FPS

This will blow you away. Found first via mrdoob (with quantum rss reading capability, before the message is concieved mrdoob is there).

Alternativa Platform, previously Alternativa Game, launched their Alternativa Platform milestone 1 and really one demo would have been enough but there are some great demos there that literally put them what appears a couple laps up on the 3d FPS style engine in Flash.

The engine is highly optimized and smooth, heavy on the processor, but using the ‘t’ key you can see some nice revealing triangle rendering. Also, playing with the field of view adds for some nice game effects. (try jumping on the fans in the half-life like room in the first demo)

Check the textures

See the Matrix

Get superpowers

From Above, Isometric

Here is what is to come from the platform:

Congrats to the Russian based Alternativa Platform, the world is watching.

Box2DFlashAS3 Version 2 Released – AS3 2D Physics Engine

Box2dFlashAS3 has been updated to version 2.0 complete with ragdolls and Theo Jansen walkers ala APE fame.

PyAMF 0.3 Released and Sample on Google App Engine

A great Action Message Format (AMF) remoting kit for server side for the pythonistas is pyAMF, they recently released PyAMF 0.3 and have a sample running up on Google App Engine. There is also a tutorial for getting PyAMF running on Google App Engine. Aral Balkan got this running as well.

Features of pyAMF currently:

More on the PyAMF library:

HOWTO: Using AS3 to Get Age from Birthday (Birthdate)

I had to implement a get age method for something we were working on. I was surprised to not find an AS3 version easily, so busted one out. I thought maybe this would be in as3corelib but nope. So posting this in case anyone else is looking for a get age script in AS3. It was quick so any improvements just post them. It will be added to my utilities classes on google code soon it is in quick form so you can jsut plop in an .fla or a class.

The pseudo code is the same for getting age in any language. Get current date, get birthdate to compare. Subtract the current years from the birthday years, then subtract one more year if the day or month is less than today’s day and month.


function calculateAge(birthdate:Date):Number {
    var dtNow:Date = new Date();// gets current date
    var currentMonth:Number = dtNow.getMonth();
    var currentDay:Number = dtNow.getDay();
    var currentYear:Number = dtNow.getFullYear();

    var bdMonth:Number = birthdate.getMonth();
    var bdDay:Number = birthdate.getDay();
    var bdYear:Number = birthdate.getFullYear();

    // get the difference in years
    var years:Number = dtNow.getFullYear() - birthdate.getFullYear();
    // subtract another year if we're before the
    // birth day in the current year
    if (currentMonth < bdMonth || (currentMonth == bdMonth && currentDay < bdDay)) {
        years--;
    }
    return years;
}

function dateStringToObject(dateString):Date {
    var date_ar = dateString.split("/");
    return new Date(date_ar[2],date_ar[0] - 1,date_ar[1]);
}

var dateNow:Date = new Date();
var checkDate:String = "11/25/1976";
var dateBirthday:Date = dateStringToObject(checkDate);
trace("dateNow = "+dateNow);
trace("dateBirthday = "+dateBirthday);
trace("age = "+calculateAge(dateBirthday));

Photosynth in Flash (pseudo-3D photo browser)

Vladimir Slepnev, Moscow, Russia creates Photosynth in Flash called OpenPhotoVR.

It appears that the files are uploaded and attached manually. But it mimics Microsoft Photosynth pretty well. You have to give it time to load and prepare the views but it is probably under heavier traffic from reddit.

OpenPhotoVR.org is a pseudo-3D photo browser, a free analog to Microsoft Photosynth. Users create photo albums by uploading pictures and linking them together by hand.

Follow

Get every new post delivered to your Inbox.