Archive

Archive for July, 2006

Drawing Shapes in ActionScript 3.0 Tutorial

July 28th, 2006 Fraser Crosbie 4 comments

ActionScript 3.0 has some great new functions to simplify drawing shapes. Previously in ActionScript 2.0 you had to specify each point in a shape and draw lines between them. Now, you can use drawCircle, drawEllipse, drawRect & drawRoundRect to speed up the process.

Lets take a look at how it is done:

Read more…

ActionScript 3.0 Document Class Tutorial

July 28th, 2006 Fraser Crosbie 6 comments

Well, it appears that in my previous posts about ActionScript 3.0, I am a bit old school. I have been instantiating my code from the first frame of the timeline using the import statement. After opening up a few of the as3_labs_samples_062706 and realizing that there is no code on the timeline, just a disclaimer, I started to scratch my head. I checked the library of the .fla to see if I could see any linkages. Still, I could not find any reference to the external code. The next place I checked was the Publish Settings (Ctrl-Shift+F12) and lo and behold, I found my answer. If you click on the Flash tab, then on the settings… button you will see the new Document class: field. Using this field you can instantiate your code. This is a much cleaner way of doing things. Finally a Flash Developer’s dream come true, no more code on the timeline.

No mx classes in Flash 9 Public Alpha?

July 27th, 2006 Fraser Crosbie No comments

In the previous post, Debugging in AS3 – Part 2 – Objects, I would have preferred to show you how to debug Objects with the ObjectDumper. The ObjectDumper can be imported using import mx.data.binding.Objectdumper. I tried this in ActionScript 3 and it would not work. I soon realized that all of the mx classes that shipped with Flash 9 Public Alpha are still written in ActionScript 2 and it appears that when you are publishing in ActionScript 3 the path to the mx classes is disabled. This means that we will have to wait to use a lot of the great functionality (Tween, ObjectDumper, etc.) that I took for granted in ActionScript 2. I did read somewhere that you can take the mx classes from the Flex SDK. Seeing as how I am still coding my work related projects in AS2 and only learning AS3 to get a head start, I will just wait until, hopefully, the next release.

Categories: Flash Development Tags: ,

Debugging in ActionScript 3.0 – Part 2 – Objects Tutorial

July 26th, 2006 Fraser Crosbie 3 comments

Last post I talked about using trace in order to debug variables in Flash. As I mentioned before, trace works great for Strings and Numbers, but not so good for Objects & Arrays. Tracing an Object will return [object Object], which does not tell you much. To see the insides of an Object you can use a for loop. Add the following code to a new actionScript file called ObjectDebug.as:

Read more…

Debugging in ActionScript 3.0 – Part 1 – Trace Tutorial

July 25th, 2006 Fraser Crosbie 8 comments

One of the most important things to know about any programming language is how to debug. In ActionScript trace is the most common way to write data into the output window in order to figure out where your program is breaking. Here is an example of using trace in ActionScript 3.0:

Read more…