PDA

View Full Version : Duplicate Sprite


I_Dont_Have_A_Name
08-06-2003, 12:15 PM
ok am trying to duplicate a shape 9 times so i did a for loop with the duplicateSprite action in it but it only duplicated it 1 time

here is my code ( the shape name is Row1C )

onFrame (1) {
for (i = 0; i<9; i++) {
Row1C.duplicateSprite(Row1C + i,1);
(Row1C + i)._X += 68;
}
}

I_Dont_Have_A_Name
08-06-2003, 02:21 PM
well i changed the code a little b/c i found some errors but it still only duplicates 1 time and with some testing i found that it makes the last one ( number 8 ) and not 1-7


here is the new code
onFrame (1) {
*for (i = 1; i<9; i++) {
* *Row1C.duplicateSprite("Row1C" + i,1);
* *("Row1C" + i)._X += 68 * i;
*}
}

laughter
08-06-2003, 02:25 PM
Wish i could help ya but im not working in swishmax atm till export release helps but in reg swish it was easier i think cause all u had to do is click loop lol

I_Dont_Have_A_Name
08-06-2003, 02:29 PM
Originally posted by laughter@Aug 6 2003, 12:25 PM
but in reg swish it was easier i think cause all u had to do is click loop lol
the for loop am doing and the loop in swish2 are completely different

dammitjanet
08-06-2003, 05:43 PM
Row1C.duplicateSprite("Row1C" + i,1);

this is your probelm right here.

the last part the ,1 is the level (layer) in which to laod you new duplicated sprite, since the existing sprite already occupies that level, it wont allow you to create a new one.

replace ,1 with , i+1 and that will solve you problem.

I_Dont_Have_A_Name
08-06-2003, 05:53 PM
thanks dammitjanet it works great now

I_Dont_Have_A_Name
08-06-2003, 06:43 PM
ok now i got another problem after i got it to work i saved it and when i opened it again now i get errors in the debug window but i did not change any thing

the first one is
ERROR: Cannot find target "Row1C" referenced from: "_root"

and then it goes on to Row1C1 and so on with the same error

dammitjanet
08-06-2003, 07:15 PM
what SWF version you got it running as?

if its SWF4 try 5 or 6

I_Dont_Have_A_Name
08-07-2003, 12:27 AM
thanks dammitjanet it was not the verson but now that am looking at the export tab i see that i have "Remove off-stage objects" checked so that is what did it :lol:

now i under stand that error :lol: