Untitled
public text v1 · immutable public function bounce (prop : String, size : Number, gravity : Number, max : Number) {
var i : Number = 0;
var move : Number = 0;
var axis : String = '_' + prop;
var B : Number = this [axis];
this.onEnterFrame = function () {
if (i > max) {
this.onEnterFrame = null;
}
move += gravity;
this [axis] += move;
if (this [axis] > B + size) {
this [axis] = B + size;
move *= -1;
i++;
}
}
}