View Full Version : Making unlimited number of instances
Hi,
I have 4 movie clips. I would like to create unlimited instances of these which will be layered on top of each other. Basically they have drag and drop code on them. So when one is dragged away there is another directly beneath it ready to be dragged. I dont want to use a button to do this, i would just like some code that is ran at the start that produces duplicates.
Thanks in advance
Are you sure you want to do that...unlimited movieclips that are autogenerated without user control?? thats going to be a process overload..
you are right, i dont want that actually. Ok so i would like it to create 20 of each? How would i do that?
Thanks
what are the movieclip instance names that you wish to duplicate?
testarea
square
circle
rectangle
Thanks
for (i=0; i>=19; i++){
duplicateMovieClip ("testarea", "testarea" + i, getNextHighestDepth());
duplicateMovieClip ("square", "square" + i, getNextHighestDepth());
duplicateMovieClip ("circle", "circle" + i, getNextHighestDepth());
duplicateMovieClip ("rectangle", "rectangle" + i, getNextHighestDepth());
}
This is off the top of my head, but it should work..
Hmmmm doesnt seem to work. I added this new script on a new layer called "actions". Would that be the correct place to add it? When i drag the original object away there are no more objects underneath it. Thanks for your help so far, its really apreciated and i will keep trying.
Thanks
assuming those are the instance names of the original movieclips, I dont see why it wont work...
sorry
for (i=0; i>=19; i++){
duplicateMovieClip (_root.testarea, "testarea" + i, getNextHighestDepth());
duplicateMovieClip (_root.square, "square" + i, getNextHighestDepth());
duplicateMovieClip (_root.circle, "circle" + i, getNextHighestDepth());
duplicateMovieClip (_root.rectangle, "rectangle" + i, getNextHighestDepth());
}
Hmmm unfortunetly it does not work. I cant see why it wont myself. I did start the project in flash 8 but at the moment its running in mx2004 because i had to switch computers
are the movieclips located on the _root, or in some other path?
They are just in the one .fla that i am working with all on frame 1 of the movie.
Thanks
::plankl::
03-13-2006, 02:32 PM
not good at AS but, why not to create duplicate of instance only when is draged away. don't know the coding so...
in theory, this should work
for (i=0; i>=19; i++){
duplicateMovieClip (_root.testarea, "testarea" + i, getNextHighestDepth());
duplicateMovieClip (_root.square, "square" + i, getNextHighestDepth());
duplicateMovieClip (_root.circle, "circle" + i, getNextHighestDepth());
duplicateMovieClip (_root.rectangle, "rectangle" + i, getNextHighestDepth());
}
I will keep trying. Thanks guys
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.