problem in creating a maza game by drowing line
hi
i've created a maze game
the idea is to solve the maze by drowing a line
and its works fine as long as i didn't use any thing as a background.
the code
stop();
import flash.display.Sprite;
import flash.events.MouseEvent;
var drawing:Boolean;
var isStart = false;
graphics.lineStyle(3,0x000000);
drawing = false;//to start with
stage.addEventListener(MouseEvent.MOUSE_DOWN, startDrawing);
stage.addEventListener(MouseEvent.MOUSE_MOVE, draw);
stage.addEventListener(MouseEvent.MOUSE_UP, stopDrawing);
function startDrawing(event:MouseEvent):void{
graphics.moveTo( mouseX, mouseY);
drawing = true;
}
function draw(event:MouseEvent){
if(drawing){
graphics.lineTo(mouseX,mouseY);
}
}
function stopDrawing(event:MouseEvent){
drawing = false;
}
stage.addEventListener(MouseEvent.MOUSE_MOVE, detectHits);
function detectHits(event:MouseEvent) {
if (wall_mc.hitTestPoint(mouseX,mouseY,true)) {
if (isStart == true) {
graphics.clear();
gotoAndPlay(3);
isStart = false ;
stage.removeEventListener(MouseEvent.MOUSE_MOVE, detectHits);
}
}
else if (hit_mc.hitTestPoint(mouseX,mouseY,true)) {
if (isStart == true) {
graphics.clear();
gotoAndPlay(2);
isStart = false ;
stage.removeEventListener(MouseEvent.MOUSE_MOVE, detectHits);
}
}
}
mc_start.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseClickHandler);
function fl_MouseClickHandler(event:MouseEvent):void
{
isStart = true ;
}
i need to set a background to this game
but when i do the lines never drew