Tip: Testing For NaN

I was working on a project today and I was getting NaN as a return value for a trace up until a certain point in time. I figured that a quick check in an if/else statement would solve my issue but I was wrong. Here I will outline what I initially did and the quick […]

AS2 → AS3: Using Mouse Events

Download Example Files Gone are the days of having to create objects to act as listeners for mouse events. The nasty, unruly way of AS2 has been replaced like everything else with the AS3 event model and writing mouse listeners is similar to everything else you’re now used to in AS3.

AS2 → AS3: Using Keyboard Events

Download Example Files Using the keys on your keyboard to interact with the Flash environment has changed from AS2 to AS3. While some of the AS3 code takes a couple of more lines than the AS2 stuff to get done, this is not the case with this example. The AS3 code is not only shorter […]

AS2 → AS3: Attaching Sounds From The Library

Download Example Files AS3 no longer has an attachSound() method in the Sound object so attaching sounds from the library is a little different. It’s actually more intuitive (as usual with AS3) because it acts just like attaching bitmaps and other objects out of the library.

AS2 → AS3: Retrieving FlashVars

Download Example Files I was recently working on the Image Slider that I posted here a couple of days ago and I realized I didn’t know how to access FlashVars in AS3. I quickly did a Google search and came up with the solution rather easily.

AS2 → AS3: Setting Masks Dynamically

Download Example Files The more migrating I do to AS3 the more little nuances (at least nuances when I am migrating) I find. A lot of small little methods have been switched or moved into new classes and it’s always a bit of a drag to find them. Such is the case with the setMask() […]

AS2 → AS3: Depth Management

Download Example Files Managing depths in AS2 was pretty cumbersome and annoying. You had to use methods like getNextHighestDepth() or keeping track of depths manually to make sure everything appeared on the stage properly and didn’t overwrite each other. Enter AS3 FTW!

AS2 → AS3: Setting A MovieClip’s Color Dynamically

Download Example Files The Color class has been deprecated since Flash 8 but was still usable in AS2 to set/get a MovieClip’s RGB values. That has since changed in AS3 and here is the new way of doing things.

AS2 → AS3: Scripted Tweening

Download Example Files Download TweenLite The Tween class hasn't changed at all since moving from AS2 to AS3, but there are some subtle differences in handling the events in it because of the new event architecture. Let's take a look at the code to tween a box diagonally down the stage in AS2: PLAIN TEXT […]

AS2 → AS3: Using onReleaseOutside

Download Example Files One of the things that is weird to figure out about AS3 is why a MOUSE_UP_OUTSIDE event (or something similar) was not included. This leaves for work-arounds that mimic that behavior and this is one way I've seen it done (probably not the only way, but one of the ways to skin […]