4 Replies Latest reply on Nov 15, 2006 9:11 AM by jen_saic

    Drag/Drop Using 2 Movie Clips

      This seems like such a simple problem, but after countless hours of tweaking, I can't figure out why it's not working!! Probably because I'm a semi-ActionScript-newbie...

      I'm trying to make a drag/drop interaction with one movie clip on the main timeline as the drop area and another movie clip that contains a large image as the draggable object and a small movie clip as the area that needs to touch the drop area on the main timeline.

      I also have a "Check" button that when clicked, evaluates whether the small area (not the image) has touched the drop area.

      The drag/drop part seems to be working fine with this script on the draggable image:

      on (press) {
      on (release) {

      But the evaluation part is where I can't seem to figure it out. I'm using hitTest in the "Check" button:

      on (release) {
      if (mc2.drag.hitTest(this.drop)) {
      trace("Dropped in zone");
      } else {
      trace("Dropped outside zone");

      But it always comes back with "Dropped outside zone" in the trace window, even if the two mc's are touching.

      Does anyone know how to easily do this? I think the problem lies in the fact that the object being dragged is not the object being evaluated for hitTest. I only want a small spot of the object being dragged to be evaluated for touching the target movie clip. Is there a better way than using hitTest? Does hitTest just not work for this situation? Am I missing part of the script?

      Thanks for any help you can provide.