All pastes #757984 Raw Edit

Stuff

public text v1 · immutable
·published 2007-11-01 20:17 UTC
rendered paste body
function moveBoxes() {
  /* if mouse is inside the image scroller */
  if((_root._ymouse > mainBoxHolder._y) && (_root._ymouse < (mainBoxHolder._y + mainBoxHolder._width))) {
    var mp = _root._xmouse;
    trace(mp + " > "+Stage.width);
    /* if mouse position is over half of stage and the current speed is greater than the minimum, decrease the speed */
    if(mp > Stage.width / 2 && curSpeed > -10) { /* set direction to left */
      curSpeed--;
    }
    /* else if mouse position is less than or equal half the stage and current speed is less than max, increase speed */
    else if (mp <= Stage.width/2 && curSpeed < 10)  { /* set direction to right */
      curSpeed++;
    }
  }
  /* if current speed is greater than the normal speed, decrease it by a portion of the normal speed */
  else if (curSpeed > defSpeed) { 
      curSpeed -= defSpeed/20; 
    }
  /* if current speed is less than the normal speed, increase it by a portion of the normal speed */
  else if (curSpeed < defSpeed) { curSpeed += defSpeed/20; }
  for(i=0;i<boxHolders.length;i++) {
    boxHolders[i]._x += curSpeed;
  }
}