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: Error #1010: A term is undefined and has no properties. at mygame_fla::MainTimeline/OPTIONbtn()
function OPTIONbtn(e:MouseEvent):void
{
///...
optionBOX.ok_btn.addEventListener(MouseEvent.CLICK, OKbtn);
}
function OKbtn(e:MouseEvent):void
{
trace("my ok button");
}
Or
function OPTIONbtn(e:MouseEvent):void
{
///...
optionBOX.ok_btn.addEventListener(MouseEvent.CLICK, function OKbtn(e:MouseEvent):void
{
trace("my ok button");
});
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.