create movieclip in anothher class
Hi everybody...
I'm pretty new in AS3...
In class A I write
Actionscript Code:
[...]
public class A extends MovieClip
{
public function A():void {
public static var menuContainer:MovieClip;
menuContainer = new MovieClip();
addChild (menuContainer);
menuContainer.y = 200
[...]
In class B I write
Actionscript Code:
[...]
var p:menuItem_mc = new menuItem_mc()
Main.menuContainer.addChild (p)
[..]
And this works fine.
But I would like to move all the code belonging to the menu to class B...
so I commented all the code above in class A and in class B I wrote:
Actionscript Code:
var p:menuItem_mc = new menuItem_mc()
var Main.menuContainer:MovieClip;
Main.menuContainer.addChild (p)
but I got the following error:
TypeError: Error #1010: A term is undefined and has no properties.
at Menu$/deployMenu()
So...my question is: how can I create a movieclip in another class and add a child to it?
thanks,
Adam