即時通訊按下按鈕即可從圖書館播放移動圖片,而且我已將其與圖片鏈接起來,但仍然無效(這只是一小部分代碼有事件偵聽器和處理程序到位,角色移動罰款)如何從圖書館播放移動圖片,並按下按鍵
stage.addEventListener(Event.ENTER_FRAME, Move);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPress);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUp);
var aP:Boolean = false;
var dP:Boolean = false;
//creating a new Character_right instance
var character_right:Character_right = new Character_right();
function Move(vet:KeyboardEvent)
{
if(aP)
{
char.x -= 5;
char.scaleX = -0.55;
}
if(dP)
{
char.x += 5;
char.scaleX = -0.55;
}
}
function keyPress(evt:KeyboardEvent)
{
switch(evt.keyCode)
{
case Keyboard.A:
{
aP = true;
break;
}
case Keyboard.D:
{
dP = true;
character_right.play();
break;
}
}
}
function keyUp(evt:KeyboardEvent)
{
switch(evt.keyCode)
{
case Keyboard.A:
{
aP = false;
break;
}
case Keyboard.D:
{
dP = false;
break;
}
}
}
...你正在'Character_right.play()'之前執行'break' ......當然這不起作用。 – Cilan
你想做什麼,Character_right是一個電影剪輯?你有錯誤嗎? – Cilan
是的,它是一個movieclip,我有AS鏈接它,它說以下錯誤: – Smadygrady