Skip to main content
Known Participant
August 2, 2013
Question

Problem accessing nested MovieClips

  • August 2, 2013
  • 1 reply
  • 374 views

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.

This topic has been closed for replies.

1 reply

Known Participant
August 2, 2013

NEVERMIND I FIXED IT, I HAD THE LABELS WRONG, SORRY