Flash CS5 iOS Acceleration

hi all? i’m new to flash. And i wanted to create maze game with acceleration for iOS. But i don’t
know how to create boundary which is stoping AccelerationX, AccelerationY. Help ME???
here is code:
import flash.sensors.Accelerometer;
import flash.events.AccelerometerEvent;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.events.Event;

stop();
var isFalling:Boolean = false;
var theAcc:Accelerometer = new Accelerometer();
theAcc.setRequestedUpdateInterval(10);
var rad:Number;
rad = ball.width / 2;
theAcc.addEventListener(AccelerometerEvent.UPDATE, onAccUpdate);
function onAccUpdate(e:AccelerometerEvent):void{
ball.x += (e.accelerationX * 10);
ball.y -= (e.accelerationY * 10);
shadowBall.x = ball.x + 20;
shadowBall.y = ball.y + 20;
dummyBall.x = ball.x;
dummyBall.y = ball.y;

if(ball.x - rad < 0){
	ball.x = 0 + rad;
} else if(ball.x + rad > stage.stageWidth){
	ball.x = stage.stageWidth - rad;
}

if(ball.y - rad < 0){
	ball.y = 0 + rad;
} else if(ball.y + rad > stage.stageHeight){
	ball.y = stage.stageHeight - rad;
}

if(dummyBall.hitTestPoint(hole.x, hole.y, true) && 	isFalling == false){
	isFalling = true;
	hole.gotoAndPlay(2);
	ball.visible = false;
	shadowBall.visible = false;
	dummyBall.visible = false;
	resetTimer.start();
}
if(dummyBall.hitTestObject(Bound)){
	//i think i need to ADD STOPING  ACCELERATIONX, ACCELERATIONY CODE HERE.
            // but i don't know how to write it. HELP ME???
}

}

var resetTimer:Timer = new Timer(2000, 1);
resetTimer.addEventListener(TimerEvent.TIMER_COMPLETE, resetBoard);
function resetBoard(event:TimerEvent):void{
hole.gotoAndStop(1);
ball.visible = true;
shadowBall.visible = true;
ball.x = 160;
ball.y = 320;
shadowBall.x = ball.x + 20;
shadowBall.y = ball.y + 20;
isFalling = false;
}