AS2 to AS3

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 […]

AS2 → AS3: Running Actions On Intervals

Download Example Files The new Timer class in AS3 gives you the ability to create and run actions at set intervals, much like the setInterval in AS2. The difference, however, is that now you can define how many times the timer runs right within the constructor. Let's take a look at the old, haggish way […]

AS2 → AS3: Button Event Handling

Download Example Files In AS3, no longer are you able to do a simple onPress or onRelease handler to make a button (or a movie clip that acts as a button). As with pretty much everything else, all that is now event based. It may be a bit confusing at first but it's actually quite […]

AS2 → AS3: Adding Linked Symbols To The Stage

Download Example Files This is just a quick little tip on how to add symbols you've marked for linking in the library to the stage. There is a new way to handle adding things to the display list and this is the old way: PLAIN TEXT Actionscript: var holder_mc:MovieClip = this.createEmptyMovieClip("holder_mc", this.getNextHighestDepth()); var box_mc:MovieClip = […]

AS2 → AS3: Loading External Assets

Download Example Files The MovieClipLoader is no longer available in AS3 and has been replaced by the new, hip kid on the block, the Loader class. Just like pretty much everything else in AS3, Loader has a bunch of events it fires off which you can listen to and react accordingly. Below is the AS2 […]

AS2 → AS3: Main File Preloading

Download Example Files When I coded in AS2 I had a preloader that I liked to use over and over again for pretty much every file I did which always worked well for me and never had any issues. One thing to note, however, is the comments I made in the download files on Frame […]

AS2 → AS3: Basic XML Parsing

Download Example Files XML in AS3 is very different from the old AS2 firstChild stuff that we are accustomed to. With the advent of E4X in AS3, traversing XML is now much cleaner and more closely resembles XPath. Before, parsing XML gave you a whole bunch of firstChilds and childNodes that you had no idea […]

AS2 → AS3: Load An XML File

Download Example Files Loading XML in AS3 requires the use of the new Event system. In AS2 you could just tell the XML object to perform a method onLoad (when the XML file has finished loading and is ready to be parsed). In AS3 you have to add a listener to the Event.COMPLETE event and […]

AS2 → AS3: Open New Browser Window

With the advent of ActionScript 3, there are new ways to do old things. Something as simple as opening up a new browser window in AS2 is a slight bit more complicated in AS3, but when all is said and done, the language makes sense and is very clear. Let's take a look at opening […]