Код кнопки:
Code
menu_btn.addEventListener(MouseEvent.CLICK, function(){gotoAndStop("choose_lvl")});
Код movePlayer() на всякий случай:
Code
stage.addEventListener(Event.ENTER_FRAME, movePlayer);
function movePlayer(e:Event) {
moves_txt.text = String(moves);
//столкновение с блоками================================================================
if (player.hitTestObject(Wall_1)) {
if (direction == 'right'){direction = "stop"; player.x = Wall_1.x - player.width - 2;}
if (direction == 'left'){direction = "stop"; player.x = Wall_1.x + Wall_1.width + 2;}
if (direction == 'up'){direction = "stop"; player.y = Wall_1.y + Wall_1.height + 2;}
if (direction == 'down'){direction = "stop"; player.y = Wall_1.y - player.height - 2;}
}
if (player.hitTestObject(Wall_2)) {
if (direction == 'right'){direction = "stop"; player.x = Wall_2.x - player.width - 2;}
if (direction == 'left'){direction = "stop"; player.x = Wall_2.x + Wall_2.width + 2;}
if (direction == 'up'){direction = "stop"; player.y = Wall_2.y + Wall_2.height + 2;}
if (direction == 'down'){direction = "stop"; player.y = Wall_2.y - player.height - 2;}
}
if (player.hitTestObject(Wall_3)) {
if (direction == 'right'){direction = "stop"; player.x = Wall_3.x - player.width - 2;}
if (direction == 'left'){direction = "stop"; player.x = Wall_3.x + Wall_3.width + 2;}
if (direction == 'up'){direction = "stop"; player.y = Wall_3.y + Wall_3.height + 2;}
if (direction == 'down'){direction = "stop"; player.y = Wall_3.y - player.height - 2;}
}
if (player.hitTestObject(Wall_4)) {
if (direction == 'right'){direction = "stop"; player.x = Wall_4.x - player.width - 2;}
if (direction == 'left'){direction = "stop"; player.x = Wall_4.x + Wall_4.width + 2;}
if (direction == 'up'){direction = "stop"; player.y = Wall_4.y + Wall_4.height + 2;}
if (direction == 'down'){direction = "stop"; player.y = Wall_4.y - player.height - 2;}
}
//-------------------------------------------------------------------------------------
switch (direction) {
case 'up' :
player.y -= 3.5;
break;
case 'down' :
player.y += 3.5;
break;
case 'right' :
player.x += 3.5;
break;
case 'left' :
player.x -= 3.5;
break;
case 'stop' :
break;
}
И да, "choose_lvl" на другом слое, может в этом проблема?