Copy link to clipboard
Copied
Hi I'm trying to add an event Listener to a button that is nested inside a movieclip, and that movieclip is nested inside another movieclip, but I get a null object reference error where I add the event listener:
public function OptionsClass(model:GameModel, stage:Object) {
// constructor code
_gameModel = model;
_stage = stage;
_optionsClip = new Options();
_optionsClip.gotoAndStop(1);
addChild(_optionsClip);
_optionsClip.optionsMC.controlsBtn.addEventListener(MouseEvent.MOUSE_DOWN, onControlsBtnDown); -->ERROR
_optionsClip.optionsMC.backBtn.addEventListener(MouseEvent.MOUSE_DOWN, onBackBtnDown);
}
all the instances are named correctly on the movieclips so I don't know what the problem is. If anyone knows what I'm doing wrong please let me know, thank you.
Copy link to clipboard
Copied
NEVERMIND I FIXED IT, I HAD THE LABELS WRONG, SORRY
Find more inspiration, events, and resources on the new Adobe Community
Explore Now