Skip navigation

Category Archives: AS3

Adobe has introduced their game developer tools for the Flash platform. (Now available on the creative cloud.)

Adobe Scout - Profiler for Flash Development Scout (formerly project Monacle) gives the developer a superior profiling tool during development and optimization of flash-based content.

Adobe Gaming SDKThe Adobe Gaming SDK includes libraries for Starling, Feathers, and Away3D. It leverages usage of your target device GPU.

Flash C/C++ CompilerThe Flash C/C++ compiler (formerly Alchemy) takes your C/C++ code to target the Flash player. (Update: This has now been open-sourced as Flash Crossbridge on github:

Away3D 4.0 has been released which provides integration with Starling and development with Stage3D.

Rob Bateman and the open source team also inaugurated the Away Foundation. The foundation would be supported by company sponsorship of which Adobe is a major funding partner. (I mean why not? The Away3D community has been working on this this API for 5 years now.) This would permit the development of 3D Flash enabled applications without any licensing costs, or fees.

Away3D 3.6 Cookbook I had the opportunity to get a sneak peak of Michael Ivanov’s book on Away3D 3.6 Cookbook graciously provided to me from Packt publishing. So I thought I would have a go at it to give a sneak peak on what’s covered.

Just a heads up, it is recommended to first go through the basics of using Away3D. A good introduction would be Packt’s Essential Away3D 3.6. Flash magazine’s tutorial series on Away3D is another good reference online to get things started.

Michael goes through several techniques in Away3D development. What is great about his recipes are that he addresses topics that you are not likely to see from basic courses, but the cool stuff, or the things that might be potentially requested by a client. It is a great reference to pick things up right away.

Some of the interesting things that are covered in this book:

  • Away3D materials to view video on demand (VOD) streaming, and usage of the Pixel Bender toolkit.
  • 3D interactivity
  • Special effects (using the Camera, bitmap manipulation)
  • Solutions to depth-sorting, and optimization
  • Tips in using software to improve your workflow (Prefab3D, and importing/loading 3D assets of major 3D software tools [3DsMax, Maya, Blender])
  • Away3D Lite development. This optimized version quadruples the performance compared to the standard engine (with the trade-off of a limited feature set, but ideal for simple projects)

There is much more. But I also like to mention about the appendix on FlashPlayer 11 and the Stage3D API (aka Molehill). Adobe labs just released the beta of Air 3 and for FlashPlayer 11. This would be a good opportunity to test it out.

Now, the question is that should I wait for the next Flash player to come out before tinkering with Away3D? I asked Richard Olsson, the co-developer on the Away3D team at the Flash and the City conference last June and he says that there would be no problem to migrate over to Away3D 4 once you grasp the concepts of 3D development with Away 3D 3.6. So it is a good time to start learning 3D development.

I hope this review was useful. These are exciting times in Flash development, particularly in the area of 3D.

Every time when I consider using custom events I have to scour the web for it. So I am writing my personal notes for it.

Here is a good link about forming your custom event:

Robert Penner also posts his observations on event handling from the Flash community.

One important aspect is the requirement of overriding the clone method (via Keith Peters.) Ben Clinkinbeard quotes on Robert’s post : “clone() is only called if an event is manually re-dispatched by passing it to dispatchEvent() again. So if a parent catches it and then does dispatchEvent( childEvent ), clone() will be used and required. Bubbling alone does not call clone(), but overriding it is good practice.”

My observation is that I have been getting errors in Flash Builder regarding to the order of parameters. So by adding new arguments after all the default arguments would give me errors. This was resolved when I added my new arguments after the “type” argument. So here is a code snippet.

[cc lang=”actionscript3″ tab_size=”2″ lines=”40″ width=”575″ line_numbers=”true”]

package myFilePathToEventClass


public class MyCustomEvent extends Event
//Add Custom Event ids here
static const SOMEEVENT:String = “someEvent”;

//Add public properties here (whatever data type) … will be available in the event handler
public param1:String;
public param2:Object;

public function MyCustomEvent(type:String,
bubbles:Boolean = false,
cancelable:Boolean = true )
super(type, bubbles, cancelable);
this.param1 = param1;
this.param2 = param2;

override public function clone():Event {
return new MyCustomEvent(type, param1, param2, bubbles, cancelable);

override public toString():String {
return formatToString(“MyCustomEvent”, “type”, “param1”, “param2”, “bubbles”, “cancelable”);




[kml_flashembed publishmethod=”static” fversion=”10.0.0″ useexpressinstall=”true” movie=”” width=”230″ height=”230″ targetclass=”flashmovie” play=”true”]Get Adobe Flash player


I had recently worked through a quick tutorial on FreeSpin3D on the Adobe Edge magazine December 2009 edition. I had noticed this software through an ad on Flex and Flash developer magazine and so I had decided to check out the demo. Of course, using 3D in real-time to design your site is very cool and convenient. The 3D Phone above is simply applying a motion tween on the layer containing the 3D object and using the trackball to change the rotation about the y-axis.

Here are some of my notes during my tutorial experience:

1)    CPU resources take a hit during development and during rendering. Would it be preferable to be working off a workstation during the design? Regardless, even on the freespin 3D website, the rotating the IPod was chugging along. I wonder if it is an issue with my computer? (However, it is a year old and runs off a dual core Centrino, it should be responding well.)

2)    Behaviors:

  • Mouse control doesn’t respond well
  • Adding behaviours can be finicky. In some cases, I could not delete the behaviors I worked with.

3)    I would have liked to manually enter the x-y-z rotation values in text fields beside the trackball – feature request perhaps?

4)    It’s nice that they offer a 20% discount when you download the tutorial. This is fair for those who have really tried out the software.

Update: Flash had an excellent review posted.

I made my first AMFPHP application with Flash CS4. (Inspired by Lee Brimelow’s AMFPHP tutorial.) It is basically a countdown timer by retrieving the current time from the server. (I made this in preparation for a conference at church, and figured that since we have visits from all over the world, getting the server time via the server [which was in Eastern Time] was the best approach instead of getting the date and time via the Actionscript date class which is client side.)

I found a PHP script by Louai Munajim to retrieve the time left in days; hours; and minutes. And inserted it in the “amfphp/services” folder on my server.

[cc lang=”php” tabs=”2″ lines=”40″]


Then, in my .fla I placed a TextField on the stage with an instance name of: “countdown_txt”, and inserted this code in Flash in the Actions panel:

[cc lang=”actionscript3″ lines=40]

function onResult(response:Object):void {
trace(“response > ” + response);

var time_left_array:Array = [];
time_left_array = response.split(“;”);

if (time_left_array[0] == “0”) {
countdown_txt.text = “Today!n” + ((time_left_array[1] == “0”) ? “Right Now!n” : (time_left_array[1] + ” hoursn”));
} else {
countdown_txt.text = time_left_array[0] + ” Days : ” + time_left_array[1] + ” Hrs : ” + time_left_array[2] + ” Min”;


gw = new NetConnection();
res = new Responder(onResult, onFault);

gw.connect(“http://yourserver/amfphp/gateway.php”);“CountDown.targetDate”, res, 2009, 10, 4, 10, 0 ); // Oct 4 2009, 10 am, 0 minutes



The only issue that I had was that I was getting Flash Errors which prevented me from accessing the CountDown.php function. I found out that it was an internal server error (500) and found at the gotoandlearn forums that the .htaccess file was hindering access to the PHP method in question. Once deleting this file in the “amfphp” directory, amfphp worked fine.

[kml_flashembed publishmethod=”static” fversion=”10.0.0″ useexpressinstall=”true” movie=”” width=”160″ height=”100″ targetclass=”flashmovie”]Get Adobe Flash player



I had taken some video tutorials at Flash way back, and I always liked Robert Taylor’s appoach in using the trace command in Actionscript. I would represent this via the “tr” method in each of my classes so that when I am previewing the program, I can know in which class I can find the origin of my trace statements. AS3 is not much different since you can use multiple arguments in your function parameters.

The AS2 version used an undocumented arguments array in the parameters of a function like this:

[cc=”actionscript” tab_size=”2″ lines=”40″]
// This method in a class called MyClass

private function tr(arguments):Void {

if (arguments.length == 0) {
} else {
trace(“[MyClass] … ” + arguments.join(” : “));


In AS3,

[cc=”actionscript3″ tab_size=”2″ lines=”40″]
// This method in a class called MyClass

private function tr(… args:Array):void {

if (args.length == 0) {
} else {
trace(“[MyClass] … ” + args.join(” : “));


colbert_collision_detectionCasually checking out my Tweets and Peter Elst put this link up:

It is very difficult to perform collision detection. Usually, sometimes you need some kind of mathematical algorithm to carry it out. But Corey managed to do it at a pixel level and even at on gradient / alpha thresholds. Very impressive indeed! It’s funny to see the Stephen Colbert video. Highly recommended blog reading!

As FITC came and went at the end of April, the original developer for PureMVC Cliff Hall could not make it (sprained ankle), but Tim Willison covered for him. He posted some slides at his blog in regards to PureMVC development. He provides an example done in Flash. (I assume it to be in Flash CS4. Most examples are done in Flex. So this is a treat!)

Here are the links:


Example, Part 1, 2, 3:

Part 4, 5, 6: