Actually here's the complete explanation
This is what it looks like

The black ball can be dragged. I want the ball to be able to travel between the hole. But if it touches the black coloured area, it has to go and play "main"
And this is my code
Actionscript Code:
stop();
var lvl1:MovieClip = new Linelvl1();
lvl1.x = 400;
lvl1.y = 240;
addChild(lvl1);
lvl1.alpha = 0;
var ball:MovieClip = new Ball();
ball.x = 80;
ball.y = 380;
addChild(ball);
addEventListener(Event.ENTER_FRAME, onStart);
function onStart(evt:Event) {
var myTimer:Timer = new Timer(1000, 1);
myTimer.addEventListener(TimerEvent.TIMER, timerListener);
function timerListener (evt:TimerEvent) {
if (lvl1.alpha < .75) {
lvl1.alpha += .05;
}
}
myTimer.start();
ball.addEventListener(MouseEvent.MOUSE_DOWN, onDrag);
ball.addEventListener(MouseEvent.MOUSE_UP, onStopDrag);
function onDrag(evt:MouseEvent) {
ball.startDrag(true);
}
function onStopDrag(evt:MouseEvent) {
ball.stopDrag();
}
if (lvl1.alpha == .75) {
if (lvl1.hitTestObject(ball)) {
removeEventListener(Event.ENTER_FRAME, onStart);
removeChild(lvl1);
removeChild(ball);
gotoAndStop("main");
ball.removeEventListener(MouseEvent.MOUSE_DOWN, onDrag);
ball.removeEventListener(MouseEvent.MOUSE_UP, onStopDrag);
}
}
}