A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Making hitTest stop

  1. #1
    Junior Member
    Join Date
    Oct 2006
    Location
    New Hampshire
    Posts
    14

    Making hitTest stop

    Can anyone explain to me how to make a hitTest stop as soon as it returns TRUE. I am using the following code and everytime the hitTest returns TRUE it keeps going thereby stopping the [I]_root[Illustration] from playing past frame 2.



    function iconHit () {
    _root[icons[i]].onEnterFrame = function() {
    if (_root[icons[i]].hitTest(_root[wtHit[i]])) {
    trace(i);
    setProperty(_root[icons[i]], _visible, false);
    setProperty(_root[Illustration[i]], _visible, true);
    _root[Illustration[i]].gotoAndPlay(2);
    buttonsOn.call();
    }
    };
    };


    thanks
    Flash 8 (PC)
    Last edited by StateEgg; 02-15-2007 at 03:54 PM.

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Code:
    delete  _root[icons[i]].onEnterFrame
    gparis

  3. #3
    Junior Member
    Join Date
    Oct 2006
    Location
    New Hampshire
    Posts
    14

    Is there another option?

    Is there a way to do this while keeping the onEnterFrame?
    I need the onEnterFrame to keep everything looping and allowing the icon to constantly check for the "hit". I need a way to get out of the onEnterFrame loop once the first "hit" has been detected.

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    I need a way to get out of the onEnterFrame loop once the first "hit" has been detected.
    the way you usually write that type of statement is:
    if (condition has not been met) // do actions else delete the on.EnterFrame.

    gparis

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