you have the right idea with your code, but it works only once (when you pressed the button). you need to start calling it all the time, e g onEnterFrame