Kinda new to ActionScripting, but this should be simple for many of you (I
hope) :-)
I'd be great if someone gave me a hint on this:
I have an MC whose visibility depends on another two MC's colliding (say MC1
and MC2)
on the first frame on root, I have placed this function:
function setVisibility () {
if (_root.MC1.hitTest(_root.MC2)) {
_root.MC._visible = true;
} else {
_root.MC._visible = false;
}
}
on MC1 (the one that hits) I put:
on (press) {
startDrag(this, true);
}
on (release) {
stopDrag();
}
// call function:
onClipEvent (enterFrame) {
_root.setVisibility ();
}
this works fine...
****NOW, HERES THE PROBLEM:
Since I want to use this function in Many others MCs I need to give it a
parameter, which would be the name of any guven MC whose visibility gets turned
on or off:
Here's what I tried:
(on root:)
// note I put a parameter in the function called myMC:
function setVisibility (myMC) {
if (_root.MC1.hitTest(_root.MC2)) {
_root.myMC._visible = true;
} else {
_root.myMC._visible = false;
}
}
Then on on MC1 (the one that hits) I use the function and use the name of MC
as parameter:
on (press) {
startDrag(this, true);
}
on (release) {
stopDrag();
}
// call function:
onClipEvent (enterFrame) {
_root.setVisibility (MC);
}
but this won't work... I wonder if this has to do with using movie clips as
parameters...
Any help or ideas on this?