Hi!
This is my first post here so Hello! :mountie:
I’m relatively new to Flash and ActionScript and have a problem with the following code i’m putting together:
// creating a new testmclip object
var testmclip = new testmclip(); // creating a new testmclip object
/* create a new pop up menu
- sending the testmclip as var and "test" as label */
popupmenu = new Menu ([path: testmclip, label: "test"]);
//the menu class creates itself and adds itself to the stage
public function Menu (items:Array)
{
_items = items;
// does other stuff to add itself to stage
}
/*- it then takes the path and label and creates a new MenuItem as child of itself */
var itemone = new MenuItem(_items[0].path, _items[0].label);
addChild(itemone);
/* the MenuItem class takes the path and label and returns itself with the path and label as its children */
public function MenuItem(path,label:String)
{
_path=path;
field.text=label;
}
/* the following is the code where I need help.....
Once addedtostage --> MenuItem takes the path (which should be the testmclip object) and adds it as its child */
addChildat( _path, numChildren - 1);
The above doesn’t work.
I’m trying to send a movieclip object created in one class, to a different class - for the latter class to add as it’s child.
The code was originally Kevin Hoyts Android Component for Menu and MenuItem (http://blog.kevinhoyt.org/?p=548) … but in that the path for the menuitem was a path which loaded from url or relative path --> this I can’t do with flash…I think.
Any help appreciated!
Ray