1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
// Created by Andrew Odendaal
//
// :: DESCRIPTION ::
// Animate a ball moving to the top
// of the screen/stage and back again
//
// :: HOW TO USE ::
// create a circle shape, convert to a movieclip(mc) and
// place the registration point at the bottom center.
// give the circle mc an stage instance name of 'ball'.

var ball:MovieClip;
var initBallY:Number = _root.ball._y;

onEnterFrame = function() {
  if (_root.ball._y < 2.31) {
    _root.ball._y = initBallY;
  } else {
    _root.ball._y=_root.ball._y-10;
  }
}