Posts tagged as 'Actionscript'
Polling the keyboard in Actionscript 3
Games often need to get the current state of various keys in order to respond to user input. This is not the same as responding to key down and key up events, but is rather a case of discovering if a particular key is currently pressed.
In Actionscript 2 this was a simple matter of calling Key.isDown() with the appropriate key code. But in Actionscript 3 Key.isDown no longer exists...
Posted on 3 September 2007 | no comments | continue reading
Events in Actionscript 3
There was lots of positive feedback to yesterday’s post about my Actionscript 2 event class, so I decided to create an Actionscript 3 version. I added a lot of features while I was at it – listener priorities, preventDefault, stopNotification (aka stopImmediatePropagation), hasListeners, weak references, and to send the event as the...
Posted on 15 August 2007 | 1 comment | continue reading
Different types of weak references
Actionscript 3 seems to have two different types of weak references. The difference relates to method closures (or bound methods) and the weak references used by the EventDispatcher and Dictionary classes. Try the following…
Posted on 15 August 2007 | no comments | continue reading
Creating weak references in Actionscript 3
A weak reference is a reference that does not prevent the object from being garbage collected. 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. The source code is very short…
Posted on 15 August 2007 | 1 comment | continue reading
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...
Posted on 14 August 2007 | 6 comments | continue reading
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....
Posted on 27 July 2007 | 7 comments | continue reading
Physics for Flash Games: Slides
It was great to see so many people at my presentation yesterday at LFPUG. The presentation seemed to go down very well and I had a great evening. Here’s the slides from my presentation. If you weren’t there, they may not make a lot of sense without my talking over the top of them, but I suspect lots of people who were there want to look at the code again.
Posted on 1 June 2007 | 7 comments | continue reading
Physics for Flash Games
On Thursday this week, I’m doing a presentation on Physics for Flash Games at the London Flash Platform User Group. It’s a tricky presentation to plan because there’s such a wide range of knowledge and ability among the audience but I think I’ve come up with a presentation that has something for everyone. Hope...
Posted on 29 May 2007 | 4 comments | continue reading