Bye bye ActionScript

So I’ve decided to retire the Action Script section of my website. I don’t really work with Flash all that much anymore and to be honest, I’m getting quite rusty at it. The posts will still be available but I won’t be adding anymore moving forward.

getDefinitionByName

I have been creating a code base for a Screen Manager system that I am using for an iOS app I am building in AS3. I wanted to create a dynamic way to reference and instantiate classes that represent each of the Screens in the app so I can reuse this for other applications in the future and to make it a lot less code intensive.

I setup a series of static variables that held string names to represent each of the Screens in the application. Then when I want to create the screen and add it to the stage I use the getDefinitionByName() method and pass the string name of the class. Continue reading “getDefinitionByName”

Weak Listeners

Garbage collection can be a big deal when writing complex programs in Actionscript. Not removing EventListeners is probably one of the biggest sources of AS holding onto memory it doesn’t need.

There is a very easy way to allow GC to handle your event listener clean-up for you when creating a new event listener – the useWeakReference argument.

Here is some standard code we’ve all done million times when creating a button:

The two arguments are pretty straight forward the first is the event we’re listing for and the second is the function that is called once the event is fired, but there are actually 5 arguments that can be passed to addEventListener() here is the method definition:

the 5th argument (useWeakReference) is false by default but by setting to true, this eventListener will be automatically removed and freed for Garbage Collection when required.

Here is the new eventListener code updated to make use of useWeakReference.

Les Stroud Official Website

As the resident “web guy” for Les Stroud Productions, I was tasked with maintaining and improving upon the flagship website for Les Stroud.

Built on WordPress this site has seen many changes since I started working on it and is a great example of a “working” site. Many website are built and then left alone but this site is constantly evolving.

Whether it be the addition of jquery scrollbars and lightboxes, HTML 5 video fallback for iOS or Flash video on the homepage (with graceful fallback of course) this site is always looking to provide it’s visitors with a great user experience.

The original artwork was done by Luke Despatie & The Design Firm.

Official Rush Website

My business partner and I had the opportunity to work with SRO/Anthem to create a new online presence for the band Rush. The original site was a mish-mash of elements that had been added onto by various other service providers and we were tasked with creating a high-impact site that would streamline the site but still allow for fans to access over 30 years of information about the band.

We created both a Flash and HTML version of the site to accommodate users of all bandwidth limitations as well a custom CMS to allow for easy updates to both sides of the site.

The initial launch was timed with the release of the album Snakes and Arrows and there was a sneak peek of a new track that was offered exclusively online.

 

Syntax

So the first thing you may have noticed is that everything in AS2 that had an underscore in front of it no longer does in AS3. That is a MAJOR issues for all of us lazy coders that just want to copy and paste old AS 2 code into an AS3 document – it will fire all sorts of errors such as this one:

Warning: 1058: Migration issue: The property _x is no longer supported.  Use the DisplayObject.x property instead.

Continue reading “Syntax”