An AS 2.0 experience after a long time

Just recently I had to work on an interactive banner for Emirates Airlines and since media publishing standards in MENA region still do not allow us to develop flash content for 9.0+, I had to use ActionScript 2.0. In this blog, I will be sharing my experience working with ActionScript 2 after almost a year.

Now, let me explain a bit about the banner’s functioning. Emirates Airlines wants to show their flight durations around the globe in a way that overall there are two main categories, namely Short and Long Haul. Each category then has atleast 3 hour slots (for example, Short has 2, 3 and 5 hours, Long Haul has 10, 13, 14 hours). Each hour slot then had atleast one animation sequence (for example, 2 hour slot of Short category has 2 animation sequence, one showing Capetown, the other showing Johannesburg and both animation sequences showing a bit details about these destinations).

See where it is going. 🙂

Now, if you are developing AS 3.0 content for the last year or so and suddenly you are asked to develop an interactive banner with the details mentioned above, your mind will immediately start thinking about the old scoping issues (remember Delegate?), the not-so-feasible button event handlers with no event bubbling, amongst other AS 2 issues.

Now, just to clear, by no means this blog is a bash on ActionScript 2. It had its time. It was charming then, it still is for a lot of developers.

First of, when I started developing, I thought of this banner as a piece of cake but I started feeling the pain in the arse as the banner started showing me its true colors (as it always does :)). I started breaking the whole banner into bits and pieces of functions and classes, and at each and every step I missed a lot of AS 3 features. Like, for instance, there was a time when one of my Child class had to dispatch an event and Parent class had to listen to it. Now from my understanding, I wrote the code like below and was expecting it to work properly.

In Child class:

this.dispatchEvent ({ type: 'onClicked_Item', target: this });

And in Parent class I had:

this.myChild.addEventListener ( 'onClicked_Item', handler_Clicked_Item );

private function handler_Clicked_Item ( ):Void
trace ( 'Parent.handler_Clicked_Item' );

I just wasn’t able to get that trace. Killed myself multiple times by pulling my hairs (Yes, it makes me hell angry if someone pulls my hear so think if that someone is myself). As always, Google searches came in handy and I re-discovered Delegate and then obviously delegated the scope of the object to Parent.

The other AS 3 feature I missed was addFrameScript, but I dont know if most of the AS 2.0 developers are aware of it or not but there is a class AsBroadcaster present in the player which provides event notification and listener management capabilities that a developer can add to user-defined objects. Look it up and I bet it would come in handy as it did for me.

Null reference errors were also one of the frustrations I faced during the project. The errors were just not ellaborative enough to get me to that certain line of code causing the error. Every single time an error appeared, I had to really flow through the application to find the issue and then resolve it.

After finishing this, I say overall it was a nice experience to go back to AS 2 (and I kind of proved to myself that I can still code in AS 2 no matter how close a deadline is) but I wouldn’t certainly want that to happen again :).

An AS 2.0 experience after a long time

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s