Hi all! First time posting.

I'm working on a simple flash game where you click on a ball and it bounces, giving you a point each time you click on it without the ball touching the ground.

However my ball doesn't appear to be affected by gravity, is there any reason this could be?

package
{
import flash.display.MovieClip
import flash.text.TextField
import flash.events.Event
import flash.events.MouseEvent

public class DocumentMain extends MovieClip
{
public const GRAVITY:Number = 2;
public const BOUNCE_FACTOR: Number = 0.8;

public_bounces:TextField;
public var _highscore:TextField;
public var _ball:TextField;

private var _vx:Number;
private var _vy:Number;

public function documentMain():void
{
_vx = 0;
_vy = 0;

addEventListeners(Event.ENTER_FRAME, enterFrameHandler)
addEventListner(MouseEvent.MOUSE_DOWN, mouseDownHandler);
}

private function enterFrameHandler(e:Event):void
{
//gravitate the ball
_vy += GRAVITY;

//move the ball
_ball.x += _vx;
_ball.y += _vy;

//check stage boundaries for collision
checkBoundaryCollision();

}

private function mouseDownHandler(e:MouseEvent):void
{
//hit the ball if it has been clicked
}

private function checkBoundaryCollision():void

{
var left:Number;
var right:Number;
var bottom:Number;
var top:Number;

left = _ball.x - (_ball.width / 2);
right = _ball.x + (_ball.width / 2);
bottom = _ball.y + (_ball.height / 2);
top = _ball.y + (_ball.height / 2);

if (left < 0 && _vx < 0)
{
_ball.x = _ball.width /2;
_vx *= -1;
}
else if (right > stage.stageWidth && _vx > 0)
{
_ball.x = stagestageWidth - (_ball.width / 2);
_vx *= -1;
}
if (top < 0 && _vy < 0)
{
_ball.y = _ball.height / 2;
_vy *= -1;
}
else if (bottom > stage.stageHeight && _vy > 0)
{
_ball.y = _ball.stageHeight - (_ball.height / 2);
_vy *= -BOUNCE_FACTOR;
}
}
}
}

____________________________________________________

Is there also any good resources I could get to learn how to program easier? I'm stuck to following guides but I still don't know what half of the code means.


Thanks all for the help and sorry for posting the whole code, it wont happen again. I just don't know where it went wrong.