我正在尝试为影片剪辑编写可见 = true/false,当您按住鼠标按钮时,它是可见的,而当您松开鼠标按钮时,它就不再可见了!但我无法让它工作,请看看并帮助我:)
import flash.events.Event;
import flash.events.MouseEvent;
import flash.media.Sound;
var mouseIsDown = false;
var speed = 0;
var score = 0;
var flames:MovieClip = new Flammer()
Flammer.visible = false;
addEventListener(Event.ENTER_FRAME, mainLoop);
stage.addEventListener(MouseEvent.MOUSE_DOWN, clicked);
stage.addEventListener(MouseEvent.MOUSE_UP, unclicked);
function clicked(m:MouseEvent){
mouseIsDown = true;
}
function unclicked(m:MouseEvent){
mouseIsDown = false;
}
function mainLoop(e:Event) {
score = score + 10;
output.text = "Score: " + score;
if (mouseIsDown) {
speed -= 2;
Flammer.visible = true;
} else {
speed += 2;
}
if (speed > 10) speed = 10;
if (speed < -10) speed = -5;
Player.y += speed;
for (var i = 0; i<numChildren; i++) {
if(getChildAt(i) is Block || getChildAt(i) is Boundray) {
var b = getChildAt(i) as MovieClip;
if(b.hitTestObject(Player)) {
trace("Hit");
removeEventListener(Event.ENTER_FRAME, mainLoop);
}
}
}
}