The Actionscript 3 Cookbook is a very helpful reference, and the example code that came with it has many good examples. Unfortunately there's a modicum of bitrot in the code: compiler warnings and errors when compiling under strict mode.
Here is a patch against the version of the code I downloaded on 2007-08-24:
files/AS3CB-patch-2007-08-24.diffApply it thusly.