So i've made an object called "potato", then started a loop to check if something in "_level0" has the name of "_level0.potato". What i think is that since the the things in _level0 are objects instead of strings, the object name can't be recognized as a string, so im guessing i need to find a way to convert the object name to a string or vice versa.
var potato:MovieClip = this.createEmptyMovieClip("potato", this.getNextHighestDepth());
for(objects in _level0){
trace(_level0[objects])
if(_root[objects] == "_level0.potato"){
trace("OMG, i found a potato on level0")
}
}
Your suggestion that the objects are stored as a string is incorrect. If you try using
typeof
before youryou will see that its type is
movieclip
and your "_level0.potato" isstring
They will not be equal. But you can convert object reference to string usingString(...)
construct.And about names. You're confusing names and references. MovieClip object like some others in ac2 have property called
_name
. In this property name of object is stored like string. But only name, not the full path to its destination. For your potato mc_name
will be equal"potato"
So you could do your search like this