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

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: , ,

Sunday, May 27, 2007

Touchlib flash apps now work with Flash CS3

There were a few errors compiling the flash apps under flash CS3. I fixed those now, so get the latest update from the SVN. This probably means that they will no longer open under the Flash 9 Alpha so if you are still using that it's time to upgrade.

Labels: , ,

Tuesday, May 22, 2007

Long time..

It's been a long time since I've been able to post anything, but I really haven't had too much to blog about. I'm working a bit on strategy game in Flash 9 - think of it as Master of Orion meets Weird Worlds meets Monopoly. I'll post more when I have something worth showing. My goal is to keep it pretty simple so that I actually finish it. I also have been thinking about getting back to working on my music app Genome since both Buzz and Buze leave something to be desired under Windows Vista (and that something is 'not crashing constantly').

I am still working on building a multitouch screen for my workplace - I should have the last bit of hardware this week (a first surface mirror for projection), so I am hoping I will be able to start putting it all together. I am interested in trying out some different things like seeing how well the CityWall approach works and maybe trying to elevate the LED's slightly like the Tangent table. I ordered a big piece of silicone rubber but it sticks to my acrylic too much to be useful. I wonder if a thinner piece attached to a more rigid piece of plastic would stick less. I'd also like to try some of the plasti-dip on a thicker piece of the mylar drafting paper. I think that might work well.

Labels: , ,