code in frame 1 layer 1


//wrapDemo

//demonstrates wrapping off screen



ball.dx = 5;

ball.dy = 5;



ball.onEnterFrame = function(){

  ball.move();

  ball.checkBoundaries();

} // end enterFrame



ball.move = function(){

  ball._x += ball.dx;

  ball._y += ball.dy;

} // end move



ball.checkBoundaries = function(){

  //wrap demo



  //ball leaves right side

  if (ball._x > Stage.width){

    ball._x = 0;

  } // end if



  //ball leaves left side

  if (ball._x < 0){

    ball._x = Stage.width;

  } // end if



  //ball leaves bottom of stage

  if (ball._y > Stage.height){

    ball._y = 0;

  } // end if



  //ball leaves top of stage

  if (ball._y < 0){

    ball._y = Stage.height;

  } // end if



} // end checkboundaries



//wrapDemo

//demonstrates wrapping off screen



ball.dx = 5;

ball.dy = 5;



ball.onEnterFrame = function(){

  ball.move();

  ball.checkBoundaries();

} // end enterFrame



ball.move = function(){

  ball._x += ball.dx;

  ball._y += ball.dy;

} // end move



ball.checkBoundaries = function(){

  //wrap demo



  //ball leaves right side

  if (ball._x > Stage.width){

    ball._x = 0;

  } // end if



  //ball leaves left side

  if (ball._x < 0){

    ball._x = Stage.width;

  } // end if



  //ball leaves bottom of stage

  if (ball._y > Stage.height){

    ball._y = 0;

  } // end if



  //ball leaves top of stage

  if (ball._y < 0){

    ball._y = Stage.height;

  } // end if



} // end checkboundaries