I’ve been playing with animating perlin noise and using it at a displacement map. Here’s a little example of what I mean (source).
Tag Archives: Flash
Webcam motion detection in AS3
I converted the old webcam motion detection thing to AS3 today. Not that it improves the performance much, just wanted to play around with it (source).
Attaching a Bitmap – AS2 vs AS3
A common task that has changed drastically in ActionScript 3.0 is loading a library image via its linkageID into a BitmapData object and attaching it to a movieclip. In ActionScript 2.0, this can be done like so:
import flash.display.BitmapData var bmp:BitmapData = BitmapData.loadBitmap("linkageID"); var img = createEmptyMovieClip("img",0); img.attachBitmap(bmp,0);
In ActionScript 3.0 movieclips and bitmaps are not attached or created like this – everything is created with the new keyword. Also, a BitmapData object should be dropped into a new Bitmap, which can be added to the stage with the all-important addChild() method.
Since a library bitmap inherits from BitmapData, you now set the class of the bitmap its Linkage Properties in Flash CS3, instantiate it and wrap it in a Bitmap object that you add to the stage:
Where ‘Butterfly’ refers to the bitmap library item you’ve given the class definition ‘Butterfly’. The Base class is generated automatically. These five lines of code can be shortened to one, but is less readable:
var img = addChild(new Bitmap(new Butterfly(0,0)));
Note that in Flex Builder, unlike Flash CS3, you would embed an image using the embed meta tag, associating it with a variable, instead of its Linkage Properties dialog:
[Embed(source='image.jpg')] public var Butterfly:Class;
Building SWFs in Flex Builder is a whole different topic – so stay tuned!
Vodafone ‘Mayfly’ website
How do you make the most of now?
I created this microsite for Dare Digital back in 2005, to promote a competition running alongside BBH‘s Vodafone ‘Mayfly’ TV campaign. Users can create a mayfly with a personal message attached, which lives for just 24 hours and wanders around the environment. The best life-affirming message won a drive around Monza with Michael Schumacher in his Ferrari – the power of NOW!The client was very happy with the site – it picked up a couple of awards, even an award for my little preloader animation. You can see the site here, but note that you can’t create your own mayflies any more and the competition is long since over.
Results
- FWA ‘Site Of The Day’
- Creative Review Annual 2006
- Over 10,000 mayflies created
- Over 500,000 visitors in 6 weeks
- Average dwell time of over 4 minutes
- 55% of users went on to visit the product section