我只是一个初学者,我真的很感激一些帮助。 这是我的代码:Actionscript错误#1009无法访问空对象引用的属性或方法
import flash.events.MouseEvent;
import flash.display.MovieClip;
var currentButton:MovieClip
button1.addEventListener(MouseEvent.CLICK, mouseClick);
button2.addEventListener(MouseEvent.CLICK, mouseClick);
button3.addEventListener(MouseEvent.CLICK, mouseClick);
button4.addEventListener(MouseEvent.CLICK, mouseClick);
function mouseClick(event:MouseEvent):void {
currentButton.alpha = 1;
currentButton.mouseEnabled = true;
currentButton = event.target as MovieClip;
trace("CLICK");
currentButton.alpha = 0.7;
currentButton.mouseEnabled = false;
}
但是当我点击一个按钮,我得到这个错误:
TypeError: Error #1009: Cannot access a property or method of a null object reference. at Untitled_fla::MainTimeline/mouseClick()