Antti Kupila

Personal Blog, Portfolio and Online playground

View over the green room at Sid Lee, Montreal

Slow motion flash for debugging

So, here’s the deal. You’re working on something in flash, you test several simultaneous scripted (or not) animations out and notice something’s wrong. There’s some weird overlapping or something going on there, but it’s really hard to tell since it all happens so fast. Sure, you could leave it there as it’s barely noticable, but we want to make products that aren’t just good but perfect.

So, how do we solve this? Well, by now—since you’ve read the title—you probably know where I’m heading. Me and Svante from ACNE Digital (the company i worked for before) were talking about this and i decided that i’d come up with some slick solution that’s easy and quick to use whenever this happens. So, that’s what I did. And of course to support open sourcen and help other people make better products, you’ll get it too. For free as always.

Recorder.as

The Recorder is a pretty simple class that let’s you specify an area to record and then simply record that into RAM, which you can then play back at the desired speed. To keep it easy to share I put everything in one class, including the recorder, the playback, and the gui with an animation engine. This of course makes it more difficult/annoying to create & modify, but it’s easier to download and use as it’s only one file.

So, how do you use it?

Well, it’s pretty simple. Place the class in a folder /com/anttikupila/debug/ in your classpath. Then just import the class, and call Recorder.initialize( );. That’s it.

[as]
import com.anttikupila.debug.Recorder;
Recorder.initialize( );
[/as]

Here’s an example with some motion graphics, courtesy of Alexander Petterson (thanks Alex!):

To try it out. Click inside it first to give it focus, press and hold space, then drag an area to record and click the area. Then press space again to stop recording and start playback. Adjust speed with the up and down keys or with the dial to the right. You can hide it again by clicking space, which obviously also frees all resources required (this thing’s really ram-hungry). If you want, you can download the source to the example too.

There is really no limit on the length (except your ram/patience), but I’d keep it pretty short – basically just for the time you see the problem. After this it’ll start playing those frames in a loop at the original speed. You can adjust the playback speed from the dial to the right.

Now I know some people will say that there’s no timeline etc. But people, think about it; do you really need it? I don’t think so, and it looks nicer like this :) Less is more, ‘aye. Still, if you want, feel free to add additional controls (if so, please help everybody else and share the code).

Actionscript 2.0 only at the moment, sorry about that. Still, it’s very easy to port to AS3 if you need to do so. Also i want to mention that this is something i made in like one or two days, so please don’t use it in any production environment as it is. It’s meant as a debug tool so bug threshold isn’t the same as on production sites ;)

I’d love to hear your comments & suggestions

Enjoy :)

Exploring San Francisco

So..I’m sitting here, writing this from my new workplace, AKQA, from the other side of the globe compared to all my previous posts here. Very exciting. I’ve never been to the US before, and also working at a big company makes stuff pretty different. Well, everything’s been great so far and and frankly i can’t expect anything less from the future.

I would add some cool (cheesy) photo of the Golden Gate or something, but I haven’t got any photos of SF yet. Still, I have my camera with me and will post some pics as i get some on .. uh .. the sensor. I could add that as a hobby photographer the city is amazing. Loads and loads of cool districts. Add to that the cool cablecars, the hills, Alcatraz and the Golden Gate bridge you can’t miss a typical postcard-San Francisco-photo ;)

By the way; If any of my readers are in San Francisco drop me a note and we’ll go out, grab a couple cold ones :)