mc duplicates only 2 times

  • meAsking
  • Beginner
  • Beginner
  • meAsking
  • Posts: 38

Post 3+ Months Ago

Hey all,
why does the code below duplicate only 2 times where the loop is set up for 15 times? Tried to figure out for a while and nothing. Please help. Thanks

Code: [ Select ]
var testContainer:MovieClip = this.createEmptyMovieClip ("testCon", this.getNextHighestDepth());
var testAttach;
testAttach = testCon.attachMovie("ph_mc1", "testConATTCH", this.getNextHighestDepth(), {_x:200, _y:200});

for (var m = 0; m < 15; m++){
    trace("mTimes");
    b = _root.testCon.testConATTCH
    duplicateMovieClip(b, "attach_dup"+m, m);
    a = _root.testCon["attach_dup"+m];
    a._x = 400+(m*60);
}
  1. var testContainer:MovieClip = this.createEmptyMovieClip ("testCon", this.getNextHighestDepth());
  2. var testAttach;
  3. testAttach = testCon.attachMovie("ph_mc1", "testConATTCH", this.getNextHighestDepth(), {_x:200, _y:200});
  4. for (var m = 0; m < 15; m++){
  5.     trace("mTimes");
  6.     b = _root.testCon.testConATTCH
  7.     duplicateMovieClip(b, "attach_dup"+m, m);
  8.     a = _root.testCon["attach_dup"+m];
  9.     a._x = 400+(m*60);
  10. }
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • meAsking
  • Beginner
  • Beginner
  • meAsking
  • Posts: 38

Post 3+ Months Ago

Here's the solution...
The problem was with the depth of the duplicate function. the duplicates kept over-writing one another. in other words, two dups were created and the next ones took the place of the first ones on stage and so on.

Once I changed the depth to m+200 instead of just m, it worked! (I guess it couldn't start at 0)

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 9 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.