Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > General > Best Practices

Reply
 
Thread Tools Rate Thread Display Modes
Old 06-18-2007, 06:59 AM   #1
evride
2006 Man Of The Year
 
evride's Avatar
 
Join Date: Mar 2007
Posts: 880
Default duplicated clips - first post

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.
evride is offline   Reply With Quote
Old 06-18-2007, 11:23 AM   #2
hangalot
lala
 
hangalot's Avatar
 
Join Date: Feb 2002
Location: on the road
Posts: 2,859
Default

most movieclip functions like duplicatemovieclip, atatchMovie createemptymovieclip etc return a refrence to the clip you just created.
ActionScript Code:
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?>
__________________
oi poloi
http://www.memorphic.com/news/
hangalot is offline   Reply With Quote
Old 06-18-2007, 10:21 PM   #3
evride
2006 Man Of The Year
 
evride's Avatar
 
Join Date: Mar 2007
Posts: 880
Default

Sepy
evride is offline   Reply With Quote
Old 06-19-2007, 10:02 AM   #4
hangalot
lala
 
hangalot's Avatar
 
Join Date: Feb 2002
Location: on the road
Posts: 2,859
Default

does it have templates. fdt came with a static create function template for movieclips which was good and encapsulated some good principles
__________________
oi poloi
http://www.memorphic.com/news/
hangalot is offline   Reply With Quote
Old 06-19-2007, 01:05 PM   #5
Jesse
Administrator
 
Jesse's Avatar
 
Join Date: Nov 2000
Location: Australia
Posts: 8,612
Default

Best Practice is the new syntax which Hangalot showed. See the Advanced Pathing tutorial which explains how to use it in depth.
__________________
Cheers

Jesse Stratford
ActionScript.org Cofounder
Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org

Please don't email or PM me Flash questions, that's what the Forums are for!

Please don't rely on me reading my PMs either. Email me about important stuff.
Jesse is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Text in Duplicated Movie Clips globo Simple Stuff (Newbies) 1 06-27-2007 05:41 AM
adding code to duplicated movie clips shananicole ActionScript 2.0 1 12-19-2005 04:48 PM
dynamic fading on duplicated movie clips stebennettsjb ActionScript 1.0 (and below) 19 01-05-2004 10:14 PM
Re-positioning duplicated clips kiebz ActionScript 1.0 (and below) 2 09-15-2003 01:03 PM
function calls in duplicated movie clips pauberson ActionScript 1.0 (and below) 1 02-17-2001 12:53 AM


All times are GMT. The time now is 11:03 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.