Problem in loops

hello,
am new to this forum as wel as to th actionscript language…im making bouncing ball clip. for that ive written so far…

onClipEvent (load) {
var yspeed = 10;
var ypos = 400;
var count = 0;
}
onClipEvent (enterFrame) {

this._y = _y+yspeed;

    if (this._y>=400) {
    yspeed = -yspeed;
    }
    if (this._y<=300) {
        yspeed =10;

        trace(this._y);
        trace("abc");
    }
    if (this._y<=200) {
        yspeed = 10;


        trace(this._y);
        trace("abc");
      }
    }

i want to bounce ball by this method only…it should bounce 3 times and then stop.plz help me in coding this in if loops?