labs: April 2008 Archives

becool.jpg

A universal truth of flash is that stuff just needs to be on pixel to look good. Sometimes that's a total pain in the butt. You may get handed a flash file by someone who doesn't realize the importance of the rounded number, or you may just forget until its too late.

That's where you can play it like the Fonz and use our SnapToPixel flash extension. Written in JSFL (or jasofell, if you prefer), the command lives in "Commands -> SnapToPixel" and quite simply runs through all the keyframes on each layer and makes sure each object, text or movieclip is on pixel.

Keep in mind that this will not work on strait-up shapes because of the way jasofell treats them. There also may be a little hankiness if your object is rotated at all (at which point, snapping to pixel won't matter anyway).

Originally written a year ago, we've updated to work correctly with CS3. You can check it out at our google code page. And, if you're so curious, you can see the outrageously simple source code in our squidder svn.

Delayer, uh, delays call to a function

Sometimes all you want to do is wait a few seconds to make a call to a given function, particularly when you're doing some sequenced animation. While this is certainly easier now that we've got the Timer instead of setInterval (*shudder*), it's still not a one-liner, especially once you take garbage collection into account.

That's where Delayer comes in. 

  1. import com.squidder.delayer.Delayer;
  2. new Delayer( _testfunction , 3000 , "hello there" , 33 );
  3. function _testfunction( s:String , n:Number ) : void {
  4.       trace( s + " , " + n );
  5. }

Simple enough! The only required variables are the function and the delay (in milliseconds). From there, you can pass through as many arguments you like, if any. There's also a cancel function, in case you're into that kind of thing.

Go grab it up over at our fancy Google Code project page.

AS3 library for the wiimote + mac

default.aspx.jpeg

While the folks at wiiflash.org have done a great job of providing wii functionality in flash, there remains a large-ish gap when it comes to mac support. 

That's where MoteDaemon, an awesome project out of Berlin, comes in. Ultimately, the plan is to integrate the tiny server application with the wiiflash.org library, but it updates have been spotty at best. To fill the gap in the interim, however, we have developed an as3 library based on Sebastian's javascript / as1/2 examples using the XMLSockets.

A very early version is available here and while we may not grow this library much beyond its current state -- hopefully we'll find a way to get into the wii flash library with a mac -- you may find it handy (or at least fun).
AS3 and Flash you'll lose your ink over.