function OPTIONbtn(e:MouseEvent):void
{
trace("play");
var ClickSound:click_sound = new click_sound(); //attach sounds
var myChannel:SoundChannel = ClickSound.play();
var optionBOX:MovieClip = new option_box(); //attach movieclip
addChild(optionBOX);
optionBOX.x = 480;
optionBOX.y = 300;
optionBOX.ok_btn.addEventListener(MouseEvent.CLICK, OKbtn);
function OKbtn(e:MouseEvent):void
{
trace("my ok button");
}
}
TypeError:错误#1010:术语未定义且没有属性。在 mygame_fla :: MainTimeline / OPTIONbtn()
答案 0 :(得分:0)
function OPTIONbtn(e:MouseEvent):void
{
///...
optionBOX.ok_btn.addEventListener(MouseEvent.CLICK, OKbtn);
}
function OKbtn(e:MouseEvent):void
{
trace("my ok button");
}
或者
function OPTIONbtn(e:MouseEvent):void
{
///...
optionBOX.ok_btn.addEventListener(MouseEvent.CLICK, function OKbtn(e:MouseEvent):void
{
trace("my ok button");
});
}