here's a working example:
http://culturekiller.com/qbeans/…
and the AS:
http://pastebin.com/m5cca3871