PDA

View Full Version : Code not working need help



DariusMonsef
July 8th, 2003, 01:19 AM
for (i=1; i<30; i++) {
duplicateMovieClip("word", 'word'+i, i);
trace(i)
}


It spits out the right numbers, but I don't get 30 MC on my screen.

any ideas??

lostinbeta
July 8th, 2003, 01:31 AM
for (i=1; i<=30; i++) {
word.duplicateMovieClip("word"+i, i);
trace(i)
}

Try that.

DariusMonsef
July 8th, 2003, 01:35 AM
This might be a dumb question, but does this code need to be on the MC that it is dupping, or in an onload or something

lostinbeta
July 8th, 2003, 01:49 AM
It needs to be on a frame. The mc that is being duplicated needs to be on the stage and have the instance name "word" (no quotes)


Also keep in mind your current script as is just duplicates each clip and puts it in the original location, so that will just end up giving you a stack of duplicated clips and you won't be able to visually see all 30 clips

ahmed
July 8th, 2003, 02:00 AM
good point lost =)

do this

for (i=1; i<=30; i++) {
var clip = word.duplicateMovieClip("word"+i, i);
clip._x = Math.random(Stage.width)
clip._y = Math.random(Stage.height)
} :)

DariusMonsef
July 8th, 2003, 04:19 AM
Thanks for the great help.

Ahmed, I ahd to remove the math. to get it to work, but thanks.