Converting Object Names to Strings in AS2 -


so i've made object called "potato", started loop check if in "_level0" has name of "_level0.potato". think since the things in _level0 objects instead of strings, object name can't recognized string, im guessing need find way convert object name 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, found potato on level0")     } } 

your suggestion objects stored string incorrect. if try using typeof before

trace(typeof _level0[objects]) 

you see type movieclip , "_level0.potato" string not equal. can convert object reference string using string(...) construct.

and names. you're confusing names , references. movieclip object others in ac2 have property called _name. in property name of object stored string. name, not full path destination. potato mc _name equal "potato" search this

var potato:movieclip = this.createemptymovieclip("potato",this.getnexthighestdepth()); for(objects in _level0){ trace(_level0[objects])     if(_root[objects]._name == "potato"){         trace("omg, found potato on level0")     } } 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -