Hold down button counter

Ok, i have this problem- i have a button and a dinamic text field w/ an input variable called “myLuck”. if the user clicks the mouse and holds it down the “myLuck” increses every 0.3 seconds by 1. also there is a variable called “left” which has a value of, say, 25. the user cannot use up more then the “left” is currently holding. I can’t actualy come up with a reasonable AS, but this is where i am:
[AS]on(press){
while(true){
Mouse.addListener(this.onMouseUp = function() {
break
}
if(left > 0){
left = left - 1
myLuck = myLuck + 1
}
}
}[/AS]

help anyone?