1 Reply Latest reply on Jan 15, 2009 1:28 AM by bluesqrl

    Duplicate Movie Clip not visible

    bluesqrl
      Hi all,

      Within my code, I have a series of movie clips that are dynamic text fields created with the createTextField call. The text field is dragged and dropped onto a box. At that point I want to create a duplicate of that text field and to then position it on top of the box.

      The code appears to be creating a duplicate of the original clip and the traces are all successful, however, the actual movie clip is not displayed anywhere on screen.

      I feel that it has something to do with the depth. Originally, I was passing this.getNewHighestDepth to duplicateMovieClip but that seemed to result in my existing text fields disappearing instead!

      Any help is much appreciated!

      Thank you!


        • 1. Re: Duplicate Movie Clip not visible
          bluesqrl Level 1
          I got it working... I replaced the duplicatemovieclip CreateEmptyMovieClip and then populated the fields. I'd done this before but it wouldn't work. After a bit of playing I tried removing the this. prefix so, I had..

          this.createEmptyMovieClip("CloudTagDupClip", this.getNextHighestDepth());
          _root["CloudTagDupClip"].createTextField("CloudTagDup",this.getNextHighest Depth(),XPos,YPos,Width,Height);

          which didn't work whereas the following does.

          createEmptyMovieClip("TagDupClip", getNextHighestDepth());
          _root["TagDupClip"].createTextField("TagDup",getNextHighestDepth(),XP os,YPos,Width,Height);


          Below is the solution. It works and I'm happy but, I'm not 100% sure as to why this now works.

          The fnTagOnRelease function was being called within another function as a handler for a movie clip. Is it possible that 'this' therefore related to that movie clip? Without the use of 'this' what have I actually written? I am now essentially saying to create a clip at the root?


          Anyway, I hope this solution helps somebody else!


          [CODE]function fnTagOnRelease()
          {
          this.stopDrag();
          delete this.onMouseMove;
          if (eval(this._droptarget) != mc_DropBox)
          {
          this._x = this.x;
          this._y = this.y;
          }
          else
          {
          trace("DropBox - " + this.Tag.text);

          this._x = this.x;
          this._y = this.y;
          this._visible = false;

          //Duplicate our movie clip
          //We need to NOT use this.createEmptyMovieClip
          //We need to NOT use this.getNextHighestDepth.
          //This now works but why don't we use this??? Is this applicable
          //to the previous movieclip that this function is part of. If we
          //don't use this, what level are we at?
          createEmptyMovieClip("TagDupClip", getNextHighestDepth());
          _root["TagDupClip"].createTextField("TagDup",getNextHighestDepth(),XPos,YPos,StringLength ,30);

          _root["TagDupClip"].TagDup.text = this.Tag.text;
          _root["TagDupClip"].TagDup.embedFonts = true;
          _root["TagDupClip"].TagDup.autoSize = true;
          _root["TagDupClip"].TagDup.setTextFormat(TextFormatLargeBlue);
          }
          }[/CODE]