Crickets Chirping

mon qui si, mon qui d’où

Archive for the ‘flash’ Category

Photo Booth In Flash, Without All the Flash Crap

without comments

I got this idea for a web-based photo booth application (yeah yeah real original, I know) but the only practical way to access a camera from a browser-based app is through Flash.

Now, I know databases, networks, application servers, frameworks of all kinds. If it’s code I’ve probably at least tinkered with it if not built an app and got paid for it. I take pride in my breadth of knowledge of all things programmery.

Except Flash.

I wrote this long rant on how Flash programming sucks if you’re used to doing “Real” development because the tools are all jumbled up with this Movie metaphor and the tools are bulky and sclerotic.

But then I deleted it because if I were you I’d skip past the ranting and look for the meat.

So here it is (you need to have a web cam in order for it to work):

Demo Page

.zip of the source code

This is just the first baby step, so it doesn’t do anything besides show you the live image and if you hit the space bar it grabs the current frame and shows it to the right of the live video. I’ll add more to it later but I figured if anybody else is looking for a basic starting point for a mostly actionscript-based flash app, this is pretty damn dependency-free and cruftless.

To build it you do need to have MTASC and SWFMill installed. I wrote a brain dead build.sh script for my little project. Oh sure I could do something complicated for the build using ant or rake but I’m lazy and this build.sh gratification was instant.

MTASC is an open-source flash compiler and SWFMill is used to bundle resources into a .swf file, which is what the web browser wants to load and run.

Here are some links I found helpful, since I haven’t found any good “ActionScript/Flash for People Who Have Been Spoiled by Decades of Using Real Development Tools” articles anywhere. “Flash for Programmers” would be a good short name too.

HOWTO: Develop Flash on Mac OSX with Rake, MTASC, SWFMill and TextMate

This post that’s in French but who cares since the code make sense.

This article on capturing bitmap data from the web cam. Hint: BitmapData is why there’s a “-version 8″ flag in my build script.

Snapshotter is a very similar application with source code (.fla tho so I couldn’t make much sense of it) and a bunch of server side stuff that’s all in Cold Fusion.

The comments here are helpful too.

Things I have learned so far:

Somebody at Macromedia has a hard-on for MovieClips. Fucking everything has to be goddamn movie clip to these people. Seriously- need a button? Make a movie clip of a button. Need a background image? Make a one-frame movie clip and loop it or whatever. [shakes head]

Saying ActionScript is just like JavaScript is misleading. DHTML apps have the Document Object Model, which is pretty well documented and widely implemented. ActionScript apps have a “stage” and they feel lost and lonely without a big crusty IDE hanging around them with timelines for all their movie clips.

MTASC and SWFMill are really cool. I didn’t have to pay a gazillion bucks to Adobe or use their bizarro tools.

Written by banksean

January 15th, 2007 at 11:26 pm

Posted in Code,General,flash