• Click here for a list of all my projects.
  • Click here for Touchlib info. Source code here.
  • Click here for our multitouch community site.

Monday, November 19, 2007

Team Fortress 2

I've been playing Team Fortress 2 fairly obsessively. I even bought a new mouse and microphone for it.. and I'm trying to get my hands on a new Geforce 8800 gt video card, though they are proving impossible to find. I may break down and just buy a more expensive card. If anyone wants to add me to their friends list, my steam page is http://steamcommunity.com/id/wnas/. The game is loads of fun, but the best games are ones where the team plays well cooperatively.

Saturday, November 10, 2007

Garbage Collection in Flash AS3 - another caveat


Here's another caveat for those trying to make sure their DisplayObjects are properly deleted: When testing a movie in the Flash IDE, memory isn't freed as it should be. Testing it in the browser however, exhibits the proper behavior. So, for those of you looking at your system memory usage continue to rise, be sure to test it in the browser as well. This is another reason why destructors would be nice - it would give you the ability to confirm that something is truly deleted.

Saturday, November 03, 2007

Garbage Collection in Flash AS3


I'm blogging about this because it's one area which can be potentially troublesome for people who are switching from the AS2 style of doing things to AS3. One of the big differences about AS3 is the fact that programmers have more control over the heirarchy of Display objects (formerly MovieClips). It's easier now to traverse the list of children of a display object. You can also take a display object from one parent and move it to another. In AS2, removing a Movieclip was a way to delete it. Not so in AS3. I've been running into some issues when using the Loader object. Removing the loader and calling unload on it was not enough to delete the contents of the loader. I could tell because the clips were still playing sounds even though they weren't on the stage. One reason these clips weren't getting deleted is because having an object listen for events creates a reference which will keep that object from being deleted. To help with this situation, adobe has allowed us to hook events with Weak references. Weak references are not counted as a reference, so if only weak references remain, an object should be garbage collected.


Even with weak references, it seems to be a best practice to remove all event listeners when an object is no longer needed. Because of this, I think flash needs deconstructors. There should be a way to signal that an object should be deleted and allow programmers to write code that can clean up that object's resources. Also, it would be nice to have some control over when garbage collection occurs.

Labels: , ,