Archive for November, 2007

SWFObject 2.0 beta

Sunday, November 25th, 2007

This is slightly old news but my friend and former co-worker, Geoff Stearns, has announced the beta for version 2 of his infamous swfObject on Google code. In case you haven’t heard, swfObject is probably your best, most powerful, and easiest option when it comes to embedding Flash Player content into an HTML page. The new version was rewritten from scratch and hopefully will become the official, de-facto solution for embedding SWF files in webpages. Kudos Geoff!

Skrypt Kidz 3000 Podcast

Monday, November 19th, 2007

Update: We’re up on iTunes!
Mims H. Wright - Skrypt Kidz 3000 - Skrypt Kidz 3000

A few weeks ago we asked you what you would want to hear from a new Flash podcast. The votes came in with a tutorial based podcast in the lead with 44%, followed by a discussion by experts with 18% and a healthy chunk of you (16%) thought it was irresponsible for us to bring another new podcast soul into this cruel world.

You told us what you wanted to hear and we listened to you.

But then we decided to ignore your suggestions and do something completely different.

It’s my pleasure to present Skrypt Kidz 3000 — a new semi-regular podcast where a barbarous crew of Flash and Flex developers get together to spend our precious weekend hours yakking about Flash issues. In our inaugural episode we discuss the pros and cons of using Flex over Flash. We also talk about Flex and FDT pricing and Adobe’s new wireframing tool Thermo.

Runtime Stack Information for Logging and Debugging

Sunday, November 18th, 2007

Or, “Hack Your Stack for Fun and Profit!” Yes, this is really and truly a hack, my friends, but, like many hacks, you might find it very useful. Using the Stack class I provide, you can get all sorts of information about the code being run right now: the package, class name, method, filename, and even the line number. You can also grab an Array version of a stack trace and follow it up. Sweet!

So check out this egregious hack. First, you grab the stack trace by throwing and catching a dummy Error and copping its stack trace as a string. Note, that this technique only works (and is only useful) in the Debug Player.

public static function getRawStackTrace():String
{
	var stackTrace:String;
	try
	{
		throw new Error();
	} catch (error:Error) {
		stackTrace = error.getStackTrace();
	}
	return stackTrace;
}

Then you slice it up into lines, and hack those lines into their constituent parts by some crazy regular expressions. That’s pretty much it.

public static function getPartsFromStackTraceEntry(stackEntry:String):Object
{
	return stackEntry.match(/(?P<package>[\w\d\.]+)::(?P<classname>[\w\d\.\:]*?)(?P<isStatic>\$?)\/((?P<scope>[\w\d\.\:]+)::)?(?P<method>[\w\d]+\(\))(\[(?P<filename>[\w\d\\\/\.]+):(?P<line>\d+)\])?/);
}

Fun, right? The properties in the returned Object are:

  • package
  • classname
  • isStatic
  • scope
  • method
  • filename
  • line

You can clean this up into package.classname::method with getSimplifiedStackTraceEntry().

So that’s it, it’s just some regular expressions, but with this hack you can pull out all kinds of juicy information about the context your code is running in. It can be useful for your own debugging, logging, and error reporting.

filecom.yourmajesty.debug.Stack View Source | Download (.as, 2k)

Thursday Link Dump, What a Day!

Thursday, November 15th, 2007

Boy, oh boy, do I have updates for you!

  • firstborn. My friends relaunch their flagship site. Congratulations! It’s totally PIMP! Be sure to check out Zune Journey which they just launched as well, it’s a really, really fun site. I love seeing sites like this that are just fun, cute, happy, and aren’t heavy-handed with the marketing.
  • EOS 400d site, using papervision with a photos-in-space collage to really great effect! Feels a lot like the interface in Photosynth. The hinting the camera uses to change angle toward points of interest, and smoothly traverse around objects in the foreground, make this interface really smooth and very filmic!
  • Away3D normal mapping demo. This really blew me away. Normal mapping is, I feel, somewhat of a holy grail for software 3d packages like Away3D and Papervision, because it lets you display very simplified geometry, but shade it like the high-resolution original model. You can see the bust is only rendering maybe a hundred or two hundred polys, but the impression it gives is of a very nicely detailed model, because lighting calculations use normals from a prerendered normal map rather than from geometry. BRAVO!
  • FOAM. My brilliant accomplice Drew Cummins’s new physics engine, which he created because there aren’t enough physics engines in Flash. Just kidding, he made it to play with maths and so we can make games with it! And so I can use the term Range-Kutta when talking about it, which I love.
  • PARKLAB. This one isn’t new at all, but I just wanted to point it out. These guys are great designers and great programmers, and it could be my favorite flash experiment blog out there. I’m a fan.

Code Samples for ActionScript Bible are online

Tuesday, November 13th, 2007

Hey people,

I and my publishers have gotten many comments about the lack of code samples on the AS3 Bible website. I just wanted to let you know that they’re up (mostly). The remaining chapters should be up this week.

Get it here under the download tab.