var x_speed_init:Number=4;
var y_speed_init:Number=-10;
var gravity:Number=2;
var vDamping:Number=0.8;
var x_speed:Number;
var y_speed:Number;
var bounced:Boolean=false;
var tm:Timer = new Timer(30);

this.btnToss.addEventListener(MouseEvent.MOUSE_UP,toss);
function toss(evt:MouseEvent){
x_speed=x_speed_init;
y_speed=y_speed_init;
tm.addEventListener(TimerEvent.TIMER, startTimer);
tm.start();
}

function startTimer(tevt:TimerEvent):void{

if(mcBall.x>550){
mcBall.x=100;
mcBall.y=100;
tm.stop();
}
if(bounced==false){

if(mcBall.hitTestObject(mcFloor)==true){
bounced=true;}

else {
y_speed=y_speed+gravity;
mcBall.y=mcBall.y+y_speed;
mcBall.x=mcBall.x+x_speed;
this.Coord.text=" y =" + mcBall.y + " x = " + mcBall.x;
}
}
else {
y_speed=-vDamping*y_speed;
mcBall.y=mcFloor.y+y_speed;
mcBall.x=mcBall.x+x_speed;
bounced=false;
}
}