Archive for November, 2006

Actionscript 2 Version of Snow Storm

Tuesday, November 28th, 2006

**UPDATE**More than one person seemed to have questions about the usage of this class. I have uploaded the FLA and .as in a zip file. You can unzip, open the FLA and test it. Get the zip file here.I recently posted the AS3 verion of my snow storm for the year. I thought it would be interesting to port it backwards to AS2 and see how well it performs. I am using 1000 flakes in the example below as well. You can modify that in the FLA. Here is a demo:

Here is the class:

Actionscript 3 Snow Storm Class

Monday, November 27th, 2006

It’s that time of year again. Winter is just about here and it is time for me to create snow. Last year I did a little demo of creating snow that sticks using Flash 8 and the BitmapData object. I thought that I would take a stab at doing an ActionScript 3 version. So with that said, here is an AS3 snow maker. The movie below obviously requires the Flash 9 player. I am using 1000 flakes in the example below. You can modify that in the FLA. I hope to update this and make it more dynamic in the near future but feel free to play with what is here.


Here is the class:

Awesome Interactive Flash Displays 3D Animations of Over 260 Skateboard Tricks

Tuesday, November 14th, 2006

My buddy Joe (the Kangaroo) Kromer turned me onto this site:

http://www.dxinteractive.com/skatetricks/

What a great use of Flash, 3D and video. I can’t even do a good ollie but I love this! Great work.

Portions of the Flash AVM2 Released as Open Source to the Mozilla Foundation

Tuesday, November 7th, 2006

A lot of different posts are pushing the big news about portions of the Flash AVM2 to the Mozilla Foundation. What does this mean exactly? Well, to quote Mozilla:

“The goal of the “Tamarin” project is to implement a high-performance, open source implementation of the ECMAScript 4th edition (ES4) language specification.”

The nice thing about the whole thing is that my fears of “Different Flavors of Flash Player Technology” have been calmed according to Kaourantin.net:

The plan is that Mozilla and the Adobe Flash Player will share the exact same code base now and in the future. There is no plan to fork the virtual machine at any point. Changes which go into the Mozilla source tree will be directly adopted by Adobe and vice versa.

It deals more with ES4 implementation in Firefox than anything else it seems. Take it from a few good sources to learn more:

Adobe Press Release
Mozilla Tamarin Project
Kaourantin.net

Multiple Instances of an AS2 Class Sharing Variable Values

Monday, November 6th, 2006

I recently stumbled upon something that was driving me nuts. Not sure how I never noticed this before. If you have a class something like this:

class MyClass{private var myList:Array=new Array();

public function MyClass(){}

public function pushItem(item:Object){  myList.push(item);}

public function popItem():Object{  return myList.pop();}}

And then create two instances of that class inside your FLA like’a so:

var a:MyClass=new MyClass();var b:MyClass=new MyClass();

Then, push some items to each instance’s array:

a.pushItem("Hello");b.pushItem("Fred");

In the above example “a” should contain “Hello” and “b” should contain “Fred”.
Now trace the array in instance “a”:

trace(a.popItem()); //returns Fred

Now… This is the part where I started to go crazy. That makes no sense. Thankfully I ran into some details on this over at OSFlash. Visit http://osflash.org/flashcoders/as2 and look for the portion that headlines with: “Why does my initializer get shared across all instances like it’s static?” Turns out that is the way that AS2 compiles down to AS1 code behind the scenes. The fix is pretty simple. You still create the variable reference in the main portion of the class but actually assign it within the constructor of the class like so:

class MyClass{private var myList:Array;

public function MyClass(){  myList = new Array()}

public function pushItem(item:Object){  myList.push(item);}

public function popItem():Object{  return myList.pop();}}

A big thanks to the fellas over at OSFlash for posting that.