|
-
adding instance names through scripts??
hi
umm is it possible to add or change instance names by using scripts?
like if i had an MC named "thing", i could change it "thingamajigger1"
if it hits something...(hitTest...)
any1 have any opinions?
"Are those gummy worms? Can I have some?"
"Nevermind, I just saw one move by itself..."
-
I have good news for you
It is possible. Using your example and the "_name" property here is an example:
if (thing.hitTest(otherThing)) {
thing._name = "thingamajigger1";
trace(thingamajigger1._name); //Outputs: thingamajigger1 }
I tested it and it works but if your version of flash can't use this you can reference the movieclip. For example:
if (thing.hitTest(otherThing)) {
thingamajigger1 = thing;
trace(thingamajigger1); //Outputs: _level0.thing }
I have tested that too. It works because when you make a variable equal an object (or movieclip) it doesn't copy its methods variables properties etc. to the variable. It puts a reference on the variable so the compiler looks at it like thing instead of thingamajigger1.
I hope I helped,
zach_297
I have Macromedia Flash 8.
How about you?
-
ohhh, so what version is the one with the _name?
anyway thanks dude, big help!!
"Are those gummy worms? Can I have some?"
"Nevermind, I just saw one move by itself..."
-
I think _name is in Flash 4 and newer.
I have Macromedia Flash 8.
How about you?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|