0 Replies Latest reply on Oct 25, 2006 2:54 AM by Castor_uk

    Odd hitTest problem

    Castor_uk
      Hi

      I’m having a problem with hitTest in a drag and drop movie I’m working on.

      I have 5 targets in the middle of the screen and multiple drag-able movies. The idea is that the user can drag a movie over any of the targets; a hint will appear when they are correct and they can then drop it on the target, the user then repeats the activity. One target can be correct for multiple movies.

      I’m having two problems with this;

      1. Once the item is dropped the ‘hint’ still appears and will not reset.
      2. For some reason hitTest will only work for the first movie and not the rest, for example if I drag the first movie over the targets it will show the hint when required, dropping the movie outside the target sends it back to its original place but when I try another movie over the targets then the hint does not show. However if I regenerate the game and try one of the other movies over the targets the hint shows, if I now try the first movie again it works but if I try any of the others then they all stop working???

      I have even created a simple movie to recreate the problem;

      Two target instances, two drag-able movies and a dynamic text field. The main timeline has as action script of:

      function dragThis (dragIt, theTarget){
      dragIt.startDrag(false);
      theTarget.onEnterFrame = function() {
      _root.status_txt.text = this.hitTest(dragIt);
      }
      }

      function stopDragging (stopIt){
      stopIt.stopDrag();
      _root.status_txt.text = "Test: false"
      }

      And the two drag-able movies have:

      on (press) {
      _root.dragThis(this, this._parent.target_mc);
      }
      on (release) {
      _root.stopDragging(this);
      }

      &

      on (press) {
      _root.dragThis(this, this._parent.target2_mc);
      }
      on (release) {
      _root.stopDragging(this);
      }

      Once again, dragging the second and then first movies work however after dragging the first the second stops working.

      I’m missing something obvious here or I’m going about this in the totally wrong way.

      Any help would be appreciated.