What I’m trying to do is get the ball clip to detect which clip it is over & modify it’s behaviour dependant upon that.
I’m using a variable “num” for each clip to designate an individual “id” number & a “for in” loop within an onEnterFrame event to test for a hitTest.
The way I’m testing for a change in clip is:
“if (numHit != _root.hold_mc[i].num)”
This is the code as it now stands:
code:
_root.hold_mc.trackOne_mc.num = 1;
_root.hold_mc.trackTwo_mc.num = 2;
done = 0;
_root.ball_mc.onEnterFrame = function() {
this._x += 2;
for (i in _root.hold_mc) {
if (_root.ball_mc.hitTest(_root.hold_mc[i]) && done == 0) {
numHit = _root.hold_mc[i].num;
trace(numHit);
done = 1;
}
if (numHit != _root.hold_mc[i].num) {
trace("diff");
_root.ball_mc.onEnterFrame = null;
_root.ball_mc.onEnterFrame = function() {
_root.ball_mc._x -= 2;
};
}
}
};
The weird thing is (apart from the fact it does’nt work!) that the “trace” command, contained within the “if (numHit != _root.hold_mc[i].num)” condition fires at the start of the movie?
fla attached.




Reply With Quote