Problem(I think...) accessing instance objects

First up, my first post here, so hi to all. =)

Ok the problem I’ve got isn’t really a bug, I mean the code does what I want so far, but I think I might going about it the wrong way. Simple game, a breakout clone in AS3, although this time I was messing about splitting it up into classes, but was having trouble accessing instances of those classes…

Way I got around it was to… add them to arrays… example, creating an instance of a menu…


var menuItem = new MainMenu();
menuArray.push({aButton:addChild(menuItem.createStartBtn())});
menuArray.push({aButton:addChild(menuItem.createOptionBtn())});

// some time later

menuArray[0].aButton.x = 10;


That cant be right though can it? I mean I was ok with it when I was sticking instances of blocks and player paddle etc into arrays, but now sticking the menu screen into an array? :-/
Is there a better way of accessing them, other then adding them to an array like that?Or am I just worrying about nothing? :blah:

EDIT: Well, doesn’t look like I’m going to get a reply to this thread… but no worries, I found a better solution, for anyone else who might suffer a brain fart like I did and finds this, make the external class return an object, and in the main class be sure to have an object variable handy ( var bla:Object; ), just assign the returned object to that, no need for arrays. If object variable has scope, no problems accessing it form anywhere else.