# onPress loop

**URL:** <https://forum.kirupa.com/t/onpress-loop/158988>\
**Category:** Uncategorized\
**Created:** [August 13, 2005, 3:00pm UTC](https://forum.kirupa.com/t/onpress-loop/158988 "2005-08-13T15:00:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stibos](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@stibos](https://forum.kirupa.com/u/stibos)\
**Post date:** [August 13, 2005, 3:00pm UTC](https://forum.kirupa.com/t/onpress-loop/158988/1 "2005-08-13T15:00:28Z")

</div>

Another probelm im having is how to get a scroll like effect so that when the user presses a button on my swf it loops its command until the button is released. (an extension to the kirupa’s photo gallery.)

here’s what i have so far.

```auto
 
scroll_right_btn.onPress = function() { 
  var hold:Boolean
  hold = true;
  while(hold) {
   this.createEmptyMovieClip("tscroller", 1000); 
   scroll_speed = 10; 
   thumbnail_mc._x -= scroll_speed;
   delete tscroller.onEnterFrame; 
   scroll_right_btn.onRelease = function() {
	hold = false;
   }
  }
}; 

```

this creates an endless loop on loading and crashes the flashplayer, any help appreciated.

cheers, stib
