The <head> conference was a success despite some technical difficulties. I had a really good time presenting and watching other friends and colleagues present. I’m looking forward to next year.
The <head> conference was a success despite some technical difficulties. I had a really good time presenting and watching other friends and colleagues present. I’m looking forward to next year.
…was a pretty cool example of integrating flash, video, and the real world. It still didn’t make me want to see the movie though.
Since version 1.0 of a code library that I’m sure you’re tired of me talking about came out, I have been making steady updates, some of which break legacy code. I was also having trouble keeping track of which version of the library a particular demo was written for. In order to make sure that the new code library doesn’t cause unpredictable results for the old implementations I added a version check to the main class.
This version check is very simple. It checks a version number in the client code against a version number of the library (or external classes) when the main class of the library is initialized. It is also completely optional (so average users don’t need to mark up their code with version numbers).
Here’s an example:
Say you normally initialize your library using:
MyLibrary.initialize();
Which calls the initialize method:
public static function initialize():void {
// initialize library here
}
If the external code changes unexpectedly (say through an SVN update) this could cause problems that are difficult to trace. The solution is to modify the initializer to match the client code version with the initializer version.
public static const VERSION:String = "1.6";
public static function initialize(versionCheck:String = VERSION):void {
if (versionCheck != VERSION) {
throw new Error ("The version check failed! This library is version " + VERSION + ". Update your code or GTFO!");
}
// initialize library here
}
And when you run the initializer, use the version number you’re expecting.
MyLibrary.initialize("1.6");
Some things to notice with this approach:
versionCheck in the initializer, providing a version number is optional. Using MyLibrary.initialize() will still work and throw no errors.The code for my initializer in its entirety after the jump…
Continue reading
Hi. Is there anyone in the LA area who will be attending the <head> web conference and would like to meet up this week? Perhaps you have an office space that could become an LA hub, or perhaps you’d like to come over to my house for some of the presentations. If so, comment or email me!
I’ve tinkered a bit with Flash Player 10. One thing that seems almost funny about the 3D effects of Flash thus far is that very few examples show off actually 3D objects. Most examples I’ve examined show 2D planes transformed in 3D space. So, I’ve created a sample 3D cube primitive in AS3 as a convenient example for people who want to get started with their own parsers or drawing tools (etc).