I’m looking to clone an entire group, rather than having to create / load the new group each time it’s used. So it could be something like:-
buttonGroup = display.newGroup()
btnPart1 = display.newImage("button-top.png")
btnPart2 = display.newImage("button-middle.png")
btnPart3 = display.newImage("button-bottom.png")
buttonGroup:insert(btnPart1)
buttonGroup:insert(btnPart2)
buttonGroup:insert(btnPart3)
buttons = {}
for a = 1, 6, 1 do
button[a] = buttonGroup.clone() --Make a new copy of the group
button[a].x = 30
button[a].y = a \* 80
end
So I could store a a group, and then when ever I needed to use a button I could clone it rather than having to go through the process of creating it each time. I’m sure it would be much faster to clone /copy an object than have to load the image file each time.
Another example could be I might want to fill the screen with some tiles, rather than having to load the image from a file each time I could possibly store that tile and clone it each time it needs to be used. It would be much faster if I could do it this way.
Another example could be I have similar elements used in different scenes using the director class. To increase speeds, I could create a global variable containing these grouped display objects and then quickly clone them in each scene rather than having to access files, scale, set alphas, rotate, etc, etc, etc.
After a bit of google searching, here is a post with similar to what I’m looking for but was never answered:-
http://developer.anscamobile.com/forum/2011/02/25/how-make-copy-display-object
I hope that help makes it a bit clearer as to what I’m looking for =) sorry if I didn’t explain myself better previously.
Thanks for your help! [import]uid: 133056 topic_id: 27009 reply_id: 109699[/import]