3 Replies Latest reply on Nov 26, 2007 9:49 AM by Newsgroup_User

    globaltolocal

    Level 7
      Hi,

      I am trying to check for hittest on movieclips in different other
      movieclips (sorry don't find the words). To do that I created a
      prototype to convert the coordinates. But it doesn't give me the results
      I hoped for.

      Here is my code. The trace command should give similar positions when
      the clips are at the same position on the screen but they don't.

      MovieClip.prototype.getLocalCoordinates = function (targetMc) {
      var p= { x : this._x , y : this._y };
      this.localToGlobal(p);
      targetMc._parent.globalToLocal(p);
      return p;
      };

      p1x = mc1.getLocalCoordinates(mc3);

      trace(mc3.mc_unter._x + " " + p1x.x)
      if (mc3.mc_unter.hitTest(p1x.x ,p1x.y ,true)){
      trace("hit ")
      distance = 0;
      }


      Any ideas what I am doing wrong?