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? :)
Printable View
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? :)
It is possible. Using your example and the "_name" property here is an example:
I tested it and it works but if your version of flash can't use this you can reference the movieclip. For example:Quote:
if (thing.hitTest(otherThing)) {
thing._name = "thingamajigger1";}
trace(thingamajigger1._name); //Outputs: thingamajigger1
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.Quote:
if (thing.hitTest(otherThing)) {
thingamajigger1 = thing;}
trace(thingamajigger1); //Outputs: _level0.thing
I hope I helped,
zach_297
ohhh, so what version is the one with the _name? :p
anyway thanks dude, big help!! :)
I think _name is in Flash 4 and newer.