I've dynamically created a menu using MovieClips as menu items inside a public function, but I also need to access these MovieClips on the timeline, however using similar code as below works for initially creating them, but not accessing them on the timeline.
I'm attempting to access functions and child MovieClips inside each menu items.
public function createMenuFunction():void {
var buttonMC:menuButtonMC;
for (var i:uint = 1; i <= totalTopicsI; i++) {
buttonMC = new menuButtonMC();
menuMC.contentMC.addChild(buttonMC);
buttonMC.name = 'button' + i + 'MC';
menuMC.contentMC.getChildByName('button' + i + 'MC').UI();
menuMC.contentMC.getChildByName('button' + i + 'MC').y = (i - 1) * 70;
menuMC.contentMC.getChildByName('button' + i + 'MC').updateTextFunction(textO['Topic ' + i]);
menuMC.contentMC.getChildByName('button' + i + 'MC').addEventListener(MouseEvent.CLICK, updateCurrentTopicFunction);
trace('Menu ' + i + ': ' + textO['Topic ' + i]);
}
}
}
For example, the following line of code works inside this function, but not on the timeline:
menuMC.contentMC.getChildByName('button' + i + 'MC').UI();
Any suggestions are welcome.