Archive

Archive for the ‘ActionScript 3.0 Tutorial’ Category

A must-read for learning ActionScript 3.0

October 1st, 2007 Fraser Crosbie 4 comments

I just stumbled across a great article by Josh Tynjala on the Yahoo! Flash Developer Center. Josh writes about the new features of ActionScript 3.0, focusing on working with the Display List, changes to root and parent, and encapsulation. I’m sure this article has been around for some time, but if you are just getting into AS3 and have not yet seen this article, then I highly recommend you read it.

http://developer.yahoo.com/flash/articles/display-list.html

The Yahoo! Flash Developer Center also has some great open-source components available for download. I am playing around with the Charts and I am very impressed. These seem like a great and free alternative to FusionCharts, which at this time are not available for ActionScript 3.0.

Here are some examples of the Yahoo! ASTRA Charts:
http://developer.yahoo.com/flash/astra-flash/charts/examples.html

Loading and Saving External XML Data in AIR (Apollo)

July 3rd, 2007 Fraser Crosbie 4 comments

I just finished an AIR (Apollo) application that loads and saves data from an external XML file. I figured I would share the code to accomplish this task as there is not a lot of Apollo info around at this time.

First off lets start with loading an XML file and reading its contents. I realize that there are much easier ways to load XML into Flash than this, but the advantage here is that I can use File.applicationResourceDirectory which allows me to target the installation directory for the XML file that was included with the AIR package. In this snippet I am using the synchronous open method. This essentially pauses everything else in the Flash movie until it has completed its task (opening the file).

Read more…

Building a Basic Menu in ActionScript 3.0 Tutorial – Part 2 – XML

September 19th, 2006 Fraser Crosbie 25 comments

A few posts ago, I showed you how to build a basic menu using an Array of button names. Now, I will demonstrate how to build the same menu, but this time use the new XML class which is based on E4X. There are many benefits of using XML in your applications. The main reason being that it allows you to update your application instantly without having to open up Flash to republish it. XML also allows your application to be easily updated from a server side page that generates XML output. This opens up the possibility of using a CMS to modify your application, thus enabling your clients to make updates on their own. Almost every project I develop uses XML.

And now for the code:

Read more…

Building a Basic Menu in ActionScript 3.0 Tutorial – Part 1 – Array

September 7th, 2006 Fraser Crosbie 25 comments

Today I have decided to build a simple ActionScript 3.0 horizontal menu based on an array. This is a fairly common practice in Flash development as we are often using data provided from a XML file to dynamically update content within our movies. To simplify this tutorial I am going to use an array that is written within my code instead of parsing it from a XML file.

The following example will demonstrate how to loop through an array and draw a button for each item in that array. Each button will have a label, an up state and an over state. I have read that it is good practice to use the SimbleButton object whenever possible, but I am not going to use the it in this tutorial because I am interested in learning more about addChild(), getChildByName(), currentTarget, mouseChildren and other features of ActionScript 3.0 that could be avoided using the SimpleButton.

Read more…

SimpleButton and Events in ActionScript 3.0 Tutorial

August 2nd, 2006 Fraser Crosbie 16 comments

In AS3, one of the most significant changes was to make the EventDispatch class the standard tool for calling events. This is a huge step in ActionScript as code written by different developers will become a lot more similar.

In the following example I will demonstrate how to use addEventListener to add a click event to a button that is built using the new SimpleButton object. The SimpleButton is a light weight alternative to the heavier MovieClip object.

Read more…