PDA

View Full Version : talkning functions on differnent levels FMX



JimmyJimmy
January 6th, 2004, 10:48 AM
Hi All,
Well, I THOUGHT that I had a grasp on this, but I ran into a wall.
I am using the Drawing Board AS from this website. I have it (the AS) on level 2.



//Drawing Tool Actions
_root.onMouseDown = function() {
line.moveTo(_xmouse, _ymouse);
line.lineStyle(2, 0x000000, 50);
this.onMouseMove = function() {
line.lineTo(_xmouse, _ymouse);
updateAfterEvent();
}
}
_root.onMouseUp = function() {
this.onMouseMove = null;
}



Everything works great.
I have the cleanup Button (that works) on level 3:


on (release, releaseOutside, dragOut) {
_root.line.clear();
}


However, I have dragable menus on several other layers. I can't figure out for the life of me how to tell the button (that I use to drag the menus) to talk to the function on level2 to tell it that onMouseDown = Null; - or something like that.

here is a link so you can see...

Link (http://www.pyroblue.com/test/marcomm/stage.html)

Sorry for the long message. Thank you for your time and help!

yusuf
January 6th, 2004, 11:33 AM
Make your function a global one.
_global.function nameFunction () {
// your code goes here
}
//to call the function use
_global.nameFunction();

JimmyJimmy
January 6th, 2004, 01:13 PM
Hi yusuf!
Thank you for your help. I KNOW I am making this waaay harder than it is. I am having a huge brain-fart and can't quite grasp what you are telling me. I understand what you are saying, but am unable to apply it.

_root.onMouseDown = function() {
//my code here
}


would be like...

_root.onMouseDown = _global.function() {
//my code here
}


Somewhere I am missing the boat. Thank you again for all your help.

yusuf
January 6th, 2004, 02:09 PM
Omg... I'm really ill....
This is correct:
_global.hello = function() {
trace("Hello World");
};
_root.onMouseDown = function() {
_global.hello();
};
:huh: :to: :cyborg:

JimmyJimmy
January 7th, 2004, 09:26 AM
LOL
*smack forehead*
Thank you very much for your time and help. :)