Now, this is really strange… Is there a difference between onPress behaviour of a Button Symbol and a MovieClip?
I wrote this function, which was becoming to be the host of a loop, which would dynamically add items to my submenu, but, a very strange thing happened. menubutton1 is a movieclip, if i leave it this way, my object “submenu1” will be removed, when i invoke the creation of a second emptyMovieClip (the trace before the second “createEmptyMovieClip” would give me the coordinate and the trace after the “createEmptyMovieClip” returns “undefined” ) --> but if i make menubutton1 a button, it works perfectly fine, now my problem is that menubutton1-n are created dynamically in actionscript and therefor are MovieClips and MovieClips only (except if there may be a trick, to create an alpha=0 Button on the fly, which i could lay over my actual MovieClip Button - But I doubt that)
well here’s the code:
function loadentries(num, submenu_height, submenu_scrollstep)
{
eval("menubutton" + num).onRelease = function()
{
newmenubutton_name = "menubutton" + num;
submenu = "submenu" + num;
eval(newmenubutton_name)._x = menubutton_x;
eval(newmenubutton_name)._y = menubutton_y;
createEmptyMovieClip(submenu,this.getNextHighestDe pth());
eval(submenu)._x = eval(newmenubutton_name)._x;
eval(submenu)._y = eval(newmenubutton_name)._y;
count = 1;
// arrow up
newsubmenuitem = "submenuitem" + count;
eval(submenu).attachMovie("DropDown_SubMenuBG",new submenuitem,this.getNextHighestDepth());
eval(submenu)[newsubmenuitem]._width = eval(newmenubutton_name)[newmenubutton_name]._width-10;
eval(submenu)[newsubmenuitem]._height = submenu_height;
eval(submenu)[newsubmenuitem]._x = 5;
eval(submenu)[newsubmenuitem]._y += 7;
eval(submenu)[newsubmenuitem].createEmptyMovieClip("labelholder", this.getNextHighestDepth());
eval(submenu)[newsubmenuitem].labelholder.createTextField("arrowup", this.getNextHighestDepth(), 0, -2.5, 20, submenu_height);
myformat = new TextFormat();
myformat.size = "8";
myformat.font = "Arial";
eval(submenu)[newsubmenuitem].labelholder.arrowup.text = "back up again";
eval(submenu)[newsubmenuitem].labelholder.arrowup.setTextFormat(myformat);
count++;
trace(submenu1._y);
submenu = "submenu2";
createEmptyMovieClip(submenu,this.getNextHighestDe pth());
trace(submenu1._y);
switch(num)
{
case 1:
trace("entry1");
trace(submenu_height);
break;
case 2:
trace("entry2");
trace(submenu_height);
break;
}
}
}
if you want to test this code:
create at least one menu button (MovieClip), called menubutton1.
create a button, called tracer, to test if submenu1 is still there
then add this to the bottom of the code
loadentries(1, 50, 5);
tracer.onPress = function()
{
trace(submenu1._y);
}