# Basic catch game with slider

**URL:** <https://forum.kirupa.com/t/basic-catch-game-with-slider/165478>\
**Category:** Uncategorized\
**Created:** [October 11, 2005, 1:22pm UTC](https://forum.kirupa.com/t/basic-catch-game-with-slider/165478 "2005-10-11T13:22:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![interfan](https://avatars.discourse-cdn.com/v4/letter/i/cab0a1/32.png) [@interfan](https://forum.kirupa.com/u/interfan)\
**Post date:** [October 11, 2005, 1:22pm UTC](https://forum.kirupa.com/t/basic-catch-game-with-slider/165478/1 "2005-10-11T13:22:14Z")

</div>

Hi Everybody  
I am trying to create a catch game with a slider running across the bottom.  
This is my basic first attempt.  
I attach movies from the library and there is nothing on the main stage.  
It seemed to be working fine until I added the script to move the slider with the mouse rather than moving it by clicking on the keyboard. Now, it crashes and I get a message saying that a script is causing the movii to run slowly in Flash Player.

Here is the script:

var depth = 0;  
allBalls = new Array();  
function makeNewClip() {  
clearInterval(ranID);  
ran = (Math.random()\*3000)+1000;  
ranID = setInterval(makeNewClip, ran);  
newClip = \_root.attachMovie(‘circle’, ‘circle’+depth, depth++);  
allBalls.push(newClip);  
trace(allBalls);  
newClip.\_x = Math.random()\*Stage.width;  
newClip.\_y = -50;  
newClip.speed = (Math.random()\*10)+5;  
newClip.onEnterFrame = function() {  
this.\_y += this.cyflymder;  
};  
}  
makeNewClip();

\_root.attachMovie(‘slider’, ‘slider\_mc’, -1);  
slider\_mc.\_y = Stage.height-20;  
slider\_mc.onMouseMove = function() {  
this.\_x = \_xmouse;  
//updateAfterEvent();  
};  
Mouse.hide();

\_root.createEmptyMovieClip(‘watchCollision’, -2);  
watchCollision.onEnterFrame = function() {  
for (i=0; 1\<allBalls.length; i++) {  
if (allBalls\*.hitTest(slider\_mc)) {  
trace(“hit slider”);  
allBalls\*.removeMovieClip();  
allBalls.splice(i, 1);  
}  
}  
};

I would be grateful for any help/ideas.

Thanks a million
