3 Replies Latest reply on Oct 10, 2007 8:57 AM by kglad

    dragging

    jonnybennett Level 1
      Okay I have for example 25 mclips... with instance names mc1-mc25. All mcs have same properties and are draggable.
      When you drag an mc over the top of any of the other mc's part of the mc being dragged over will become visible and then when rolledoff will dissapear again.

      The following code is on all of the m.c.

      roTarget.onPress=function(){
      this._parent.startDrag();
      this._parent.swapDepths(_parent._parent.thumsIndex++);
      this.onEnterFrame=function(){
      for (p=0;p<=25;p++){
      if (hitTarget.hitTest(_parent['mc'+p].hitTargetBottom)) {
      _parent['mc'+p].hitTargetBottom._visible=true;}else{
      _parent['mc'+p].hitTargetBottom._visible=false;}}}
      }

      roTarget.onRelease(){
      delete this.onEnterFrame();}



      Problem. This works fine the first time you pick up an mc. However if the next m.c. you pick up has a higher instance name... eg... if i drag mc3 first and then try and drag mc5 next it wont work.
      I assume this is some sort of timing issue... but I dont see why. The function that makes it work is an onEneter frame, but this should be being created every time an mc is pressed.
      Any ideas? thanks J.

      Please note that if i replace in the code the dissapearing and appearing of the mc's with a trace statement it workd fine, so it is something to do with the way in which I am trying to get the m.c's to appear and dissapear. thanks.