PDA

View Full Version : mx actionscript problem with _gloabl.



colag
October 28th, 2003, 04:20 PM
hi,
i have a movie clip with functions which relate to instances of buttons eg.

onClipEvent (enterFrame) {
_root.home.onRelease = function() {
endX = 0;
endY = 0;
};
}

where home equals the home button and so on for the links buttons and contact button etc.

the problem is the buttons are not found at the _root. they are in a movie clip with an instance name 'menu'. i have tried using this in the onClipEvent function:

_global.menu=this;

_global.menu.home.onRelease = function() {
endX = 0;
endY = 0;
};

but no luck.
any suggestions would be greatly appreciated.
thanks!

Voetsjoeba
October 28th, 2003, 04:47 PM
onClipEvent (enterFrame) {
_root.home.onRelease = function() {
endX = 0;
endY = 0;
};
}


No need for the onEnterFrame, just the onRelease will do ;)

If home is inside a movieclip called menu, and menu is on the main timeline, you can target home by using _root.menu.home :)