Posts about Code snippets

Lights and shadows experiment (6)

, under ActionScript, Code snippets.

Recently I found an interesting question on, about creating light and shadows in a 2D environment. I started experimenting with this to see how far I could take it. I love to share the results and some insides about this fun project.

Wait a minute with setTimeout (1)

, under ActionScript, Code snippets.

While working on a game, I created a function spawner. The idea was to make a function which would call a function like createEnemy() a hundred times with an interval. So I quickly created a static function. Read the full post to see that the setTimeout function should be handled with care.

Javascript for AS3 developers (11)

, under Code snippets, JavaScript.

This article is some training for your JavaScript skills. I love Actionscript , and I am also starting to like JavaScript. HTML5 is an hot topic nowadays, and it seems using JavaScript is an important part of it, so why not learn more of it?

Chain Tween (3)

, under ActionScript, Code snippets.

ChainPrevious year I was working on a little class called Chain. Now I was already working at a updated version which could animate too (see this tweet from last year). Basically it has become a small tween engine. You have to know there are much better tween engines, like TweenLite, Tweener, eaze tween, gtween etc.. So you don’t need a new tween engine, and definitely not this one 🙂 I just love to share some thoughts.

Remove eventListeners automatically in AS3 (13)

, under ActionScript, Code snippets.

I hate removing listeners in AS3. So I created a work-around to autoremove them 🙂 I know there are already some solutions for this, but some of them requires a complete new event system and it is just fun to create your own sources. This class overrides the default behavior of the addEventListener function. It stores references of the listeners inside a Dictionary. The class it selfs listens to the REMOVED_FROM_STAGE event, and when it is removed, then it removes all stored events.

Quick way to create an auto-increment index AS3 (2)

, under ActionScript, Code snippets.

Quick post here. I’d like to share this very quick way to create an automatic ID or index to your class instances. Mostly I pass an index as parameter to the class instances, or I use a public var to set the index. Using this way it is very easy to create an automatically filled index, since you have to set this up once and never worry again 🙂