1 Reply Latest reply on Jul 5, 2007 10:14 AM by Newsgroup_User

    doing something wrong...

    yarkehsiow Level 1
      hi i have attached my code which i have been trying unsuccesfully to execute...
      basically, i want the "tab_mc" to be duplicated as "new_tab0", "new_tab1", "new_tab2" etc...
      but no luck... can anyone see what i am doing wrong?
      thanks!
        • 1. Re: doing something wrong...
          Level 7
          change your code from...


          > for (i=0; i<numTabs; i++) {
          > trace(i);
          > duplicateMovieClip(tab_mc, "newtab_mc" , this.getNextHighestDepth());
          > newtab_mc
          ._y+40;
          > trace("newtab_mc "+newtab_mc);
          > }
          >



          to...

          > for (i=0; i<numTabs; i++) {
          > trace(i);
          > duplicateMovieClip(tab_mc, "newtab_mc" + i,
          this.getNextHighestDepth());
          > this["newtab_mc" + i]._y+40;

          > }
          >



          I also recall reading that a movie clip cannot be duplicated unless it
          exists in the library... you may need to store the master clip in the
          library, attach it, then duplicate it...

          hope this helps...

          yarkehsiow wrote:
          > hi i have attached my code which i have been trying unsuccesfully to execute...
          > basically, i want the "tab_mc" to be duplicated as "new_tab0", "new_tab1",
          > "new_tab2" etc...
          > but no luck... can anyone see what i am doing wrong?
          > thanks!
          >
          > this.createEmptyMovieClip("tab_mc", this.getNextHighestDepth());
          > var tabColor = "0xcdcdcd";
          > var numTabs:Number = 3;
          > drawRectangle(tab_mc, 160, 39, tabColor, 100);
          > function drawRectangle(target_mc:MovieClip, vertBoxWidth:Number,
          > boxHeight:Number, fillColor, fillAlpha:Number):Void {
          > with (target_mc) {
          > lineStyle(1, 0x000000, 100);
          > beginFill(fillColor, fillAlpha);
          > moveTo(0, 0);
          > lineTo(vertBoxWidth, 0);
          > lineTo(vertBoxWidth, boxHeight);
          > lineTo(0, boxHeight);
          > lineTo(0, 0);
          > endFill();
          > }
          > }
          > for (i=0; i<numTabs; i++) {
          > trace(i);
          > duplicateMovieClip(tab_mc, "newtab_mc" , this.getNextHighestDepth());
          > newtab_mc
          ._y+40;
          > trace("newtab_mc "+newtab_mc);
          > }
          >