PDA

View Full Version : duplicated clips - first post


evride
06-18-2007, 05:59 AM
what is the best practice in duplication movie clips in a for loop? i've always used duplicateMovieClip with eval("mc_name"+i)

do u duplicateMovieClip(), attachmovie, or something else? i saw something like this i think

clip[name]._x

how is this done? can someone explain what they think is the easiest to create and work with technique to duplicate and modify movie clips in loops.

hangalot
06-18-2007, 10:23 AM
most movieclip functions like duplicatemovieclip, atatchMovie createemptymovieclip etc return a refrence to the clip you just created.

clip[name]._x

that is taking the parent clip (named clip) and searching for a name as part of a hash. this is not a good practise, albeit unavoidable at times as clip[name] is not typed meaning the compiler in as2 will not know if the property_x exists on it (meaning it can fail silently). and in as3 if a class is not declared as dynamic that will through an error and if it is declared as dynamic it will just be slow.
the easiest is not the best in this case.
what editor do you use for your coding?>

evride
06-18-2007, 09:21 PM
Sepy

hangalot
06-19-2007, 09:02 AM
does it have templates. fdt came with a static create function template for movieclips which was good and encapsulated some good principles

Jesse
06-19-2007, 12:05 PM
Best Practice is the new syntax which Hangalot showed. See the Advanced Pathing tutorial which explains how to use it in depth.