I went to see the Cage Rage 23 Mixed Martial Arts Championships last week, which saw the triumphant return of Vitor Belfort. It’s basically the UK version of the UFC, but contrary to popular belief, it’s not completely no-holds-barred combat – there are some rules
I trained with some of these guys last year at the promoter’s own gym, Elite Fighting in South London …and believe me, it is the definitive ‘School of Hard Knocks’. Elite’s very own Ed Smith lost his match to judge’s decision, hard luck Ed. But the most impressive match was former British and Commonwealth Heavyweight Boxing Champion Julius Francis being stopped in the second round by Gary Turner.
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!
The situation in Burma is deteriorating rapidly, with several protesters already killed by government troops. Governments are reluctant to step in, not least of all because China (whose demand for oil and steel is propping up the US economy right now) rely on gas from Burma and arm the nation in return. Worse still, I bet the American government is watching closely and taking notes on how to crush a civil uprising – just in case people realise how their votes were stolen.
Please go and sign the petition for action in Burma.
It’s a shame this aired years ago on British TV, but was pulled from TV in the US. It may have stopped so many people voting for Bush – twice! Or at least made it harder for Diebold to hack the election.
I was recently asked about the problem of loading XML from within a class to trigger an arbitrary method. The problem was: the onLoad event triggers on the XML instance, not the class creating it. This could probably be worked around with the Delegate class, but in the past I’ve simply extended the XML class itself, overriding the onLoad handler and adding a callback object that’s passed in (along with some error checking). It’s partnered with an XMLLoader class, the source and simple demo of which you can download here.