Posts tagged as 'Free code'

Creating weak references in Actionscript 3

It’s great that Actionscript 3 has weak references in the EventDispatcher and Dictionary classes. But sometimes you want to create your own weak references. Well, there is a way. It’s a bit of a hack, and unfortunately uses a full Dictionary object for each weak reference, but it works. The source code is very short…

Events in Actionscript 2

I documented my technique for implementing event dispatching over on the Flash Game Code site. I’ve been using this method for a couple of years now and I think it’s a lot better than EventDispatcher or ASBroadcaster. Take a look if your interested. Comments are welcome below. The source code is available for free on flashgamecode.net under the MIT licence.

Singleton Factory

I’ve mentioned before how I dislike the Singleton pattern… So this morning I was experimenting with various other possible ways to create singletons in Actionscript 3 and came up with a function that can be used to create and reuse a single instance of any class. I don’t know how useful it will turn out to be but here it is. It’s also a useful example of a package level function…

previous page