There’s lots of fun to be had with Moo mini-cards, and I’ve been getting good feedback on the batch of fractal cards I made recently, which were created by taking snapshots of one of my flash experiments. The magic behind this was so simple I may as well share it with you. All you need to create your own set is the Flex/AIR app I created, which you can download here, and a Flickr account. This is how it works:
You give the app the path to your swf, and hit enter. It then runs a function to start a timed loop, as follows:
private var _saveDir:File;
private var _timer:Timer;
private var _counter:int;
private function startSnapshot(url:String, time:Number = 5):void {
// loadedSwf is the name of the mx:Image that
// will contain the swf
loadedSwf.source = url;
// create a directory to store our snapshots
var dirName:String = "snapshots";
_saveDir = File.desktopDirectory.resolvePath(dirName);
var x:Number = 1;
while (_saveDir.exists) {
_saveDir =
File.desktopDirectory.resolvePath(dirName + String(x++));
}
_saveDir.createDirectory();
// start loop
_counter = 1;
_timer = new Timer(time * 1000);
_timer.addEventListener(TimerEvent.TIMER, snapLoop);
_timer.start();
}
Then, while the swf plays, the timer loop fires this function every few seconds to take a snapshot:
private function snapLoop(e:TimerEvent):void {
// create a new BitmapData object based on the
// size of the loaded swf
var BMPData:BitmapData = new BitmapData(loadedSwf.width,
loadedSwf.height, true, 0xFFFFFF);
// take a snapshot of the swf, and store it in
// the BitmapData object
BMPData.draw(loadedSwf);
// encode it as a jpg
var jpgEncoder:JPEGEncoder = new JPEGEncoder(80);
var jpgBytes:ByteArray = jpgEncoder.encode(BMPData);
// save it
var ourFile:File = _saveDir.resolvePath("snap" +
_counter++ + ".jpg");
var fileStream:FileStream = new FileStream();
fileStream.open(ourFile, FileMode.WRITE);
fileStream.writeBytes(jpgBytes, 0, jpgBytes.length);
fileStream.close();
}
Note that the BitmapData snap may give unexpected results with transparent swfs, so it is best used with swfs that have a solid background.
To turn these into mini-cards, the final step is to use Moo’s Flickr import option. Point it at the Flickr set you have created, pay your money, and in 10 days or so a pack of groovy cards pop through the postbox. Simple.
I love 70’s childhood pictures. It’s as if everyone’s childhood had the same washed out colour palette.
This was a little AS3 experiment I did earlier in the year, back when I used to have time for coding. It draws in random photos from flickr and applies a few filters to try and recreate that 70’s childhood pics vibe.
There’s not much to it but I was rather pleased with it. If you like it too, you might also like some of the other stuff on my generative flash page.
So, unsurprising, I was very excited by the project Tom at Flexible Factory has been working on recently. He has reverse-engineered the open source Jasper emulator, originally written in Java, and rebuilt it in ActionScript 3. From Tom’s account this sounds like it involved some pretty hardcore coding, but I’m glad he persevered as now we have Flasper, the Flash ZX Spectrum Emulator. It’s light weight, can be easily embedded in a browser, and it ROCKS!
Tom demoed this for the first time last night at Flash Brighton, the regular get together of the local Flash talent. Every time I attend one of these meeting I find myself blown away by the range and quality of work being produced across our small collective. It can be quite intimidating, I mean, if all you can show from your recent work is some pretty fractal effects, how do you follow a guy who’s been mapping and simulating the brain of a snail (Hi Peter).
Last night we also saw some sweet animation, an AIR Twitter app, and a Flash/ASP project called Communicator World, the work of unwrong, an Edinburgh company who have just moved down to Brighton. Welcome to the south coast guys, I think you’ll be right at home here.
But everyone’s work was great, so I shouldn’t single anyone out. The full list of last night’s exhibitors is on the Flash Brighton site.