Naming Objects Dynamically?

7 posts

Flag Post

What I’m Trying to do is name a series of movieclips something else with a for loop… For example something like “thing1” changing names to “thingy” dynamically. Does anyone have any idea how to do this?

 
Flag Post

hum what you are trying to do seems strange … just being curious, why do you want to do that ?

 
Flag Post

well i’m pretty sure i’m doing it in the worst way possible but I want a group of clips; eg: “thing 1” – “thing 10” to be represented as one “thingy”. of course the names are different but that’s it. like what i want is for a bunch of clips to check if one thing is hitting any of them, and if it does, the same result.Does that make sense?

 
Flag Post

Sounds like you need an array buddy :)

 
Flag Post

I don’t have much experience with arrays…Do you have any specific tutorial you could point me to?

 
Flag Post


Object should be named either when you put them on stage manually, or named by code in the attachMovie command. You can change the name by using the _name property, but thats pretty much pointless. The best way to track objects is to store a reference to them in an array as mentioned (or another object type) when you create/attach them. You can then loop through the array as desired to retrieve the reference and perform various operations on them (like collisions).


bq. Do you have any specific tutorial you could point me to?


Look through the sites that are listed under tutorials in the sticky at the top of this forum.


 
Flag Post

All right, thanks to all who helped!