# Problem in loops

**URL:** https://forum.kirupa.com/t/problem-in-loops/243144
**Category:** Uncategorized
**Created:** [November 3, 2007, 10:56am UTC](https://forum.kirupa.com/t/problem-in-loops/243144 "2007-11-03T10:56:45Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![nivedita](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@nivedita](https://forum.kirupa.com/u/nivedita)
#### Post date: [November 3, 2007, 10:56am UTC](https://forum.kirupa.com/t/problem-in-loops/243144/1 "2007-11-03T10:56:45Z")

</div>

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&gt;=400) {
    yspeed = -yspeed;
    }
    if (this._y&lt;=300) {
        yspeed =10;

        trace(this._y);
        trace("abc");
    }
    if (this._y&lt;=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?
