-
duplicatemovieclips, and possible array
hi, i'm stuck, and probably doing something stupid here...
say i have 26 movies on the stage with instance names a,b,c,d.. etc etc
i wanted to duplicate them a number of times...
i started with this which worked for a :
dupuntil = 10
for (dup=0; dup<dupuntil; dup++){
a.duplicateMovieClip("a"+dup,dup);
}
great now have 10 a's
i thought i could get away with :
dupuntil = 10
for (dup=0; dup<dupuntil; dup++){
a.duplicateMovieClip("a"+dup,dup);
b.duplicateMovieClip("b"+dup,dup);
}
but it still seems to do just the 'a' movie, and not the 'b'
so then i thought i'd try an array, this was just to try and get the 'a' done
dup = ("a","b","c" ... etc);
for (du=0;du<dup.length;du++){
dup[0].duplicateMovieClip("dup[0]"+du,du);
}
this didnt work at all, but if it did i was going to somehow make it go through all the movies, 'a', 'b', 'c' etc ...
any hints on how to get all the movies duplicated ?
thanks
ade
ps i only have Flash MX at the mo...
Last edited by webadec; 02-24-2006 at 06:46 PM.
Reason: additional info
-
you could try:
var num:Number = 0;
if (num < 10){
a.duplicateMovieClip("a"+dup,dup);
num+=1;
}
I'm sure that this won't have the same limitations.
-
for (dup=0; dup<dupuntil; dup++){
a.duplicateMovieClip("a"+dup,dup);
b.duplicateMovieClip("b"+dup,dup);
}
with this you are setting b to the same depth as a and so replacing a with b
for (dup=0; dup<dupuntil; dup++){
a.duplicateMovieClip("a"+dup,dup);
b.duplicateMovieClip("b"+dup,dup+20);
}
this should do the trick as long as dup is less than 20 of course
-
thanks to you both.... gorlummeeguvnor .. works cool...
i added a line with 'c' movie using dup+30 .. and all works good!
thanks
-
-
umm just one more question if i may ...
i also have 10 more movies with instance names .. 0 - 9 ... so i tried the same code.. but it errors with :
Scene=Scene 1, Layer=script, Frame=2: Line 29: ';' expected
1.duplicateMovieClip("1"+dup,dup+270);
Scene=Scene 1, Layer=script, Frame=2: Line 30: ';' expected
2.duplicateMovieClip("2"+dup,dup+280);
using numbers is not allowed then ?
this could be interesting as the php script strips all letters and takes the first.. ie a will = a1 = a3 =a4 etc...
if i cant use 1 as an instance name then i'll find some way of editng the php script .. as at the moment 'one' would = 'o' .... :S
-
No numbers don't work, you should stick with letters as the first.
-
-
thanks! ...i couldn't use _1 , '_' was already being used to break up the string in php
in the end i doubled up everything so i could use the instance name of 'one' and stripped the first 2 charactors.. ie aa or aa1 =aa.gif , and now i could use one as, one = on.gif
thanks for your help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|