A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [MX04]Problems getting a clip to recognise & respond to which clip it is over

Threaded View

  1. #1
    Senior Member pup100's Avatar
    Join Date
    Oct 2004
    Location
    Close
    Posts
    575

    [MX04]Problems getting a clip to recognise & respond to which clip it is over

    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.
    Last edited by pup100; 09-22-2008 at 12:08 AM.
    You will know everything when you know you never will.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center