How do I remove all duplicate clips without given its name ... it is possible ?
(In game, it creates duplicate clips and all duplicated clips have to be removed when restarting game)
Printable View
How do I remove all duplicate clips without given its name ... it is possible ?
(In game, it creates duplicate clips and all duplicated clips have to be removed when restarting game)
You can use this function:
This function removes all duplicated movie clips,Code:function RemoveAllMC(){
for (thisClip in _root){
if (typeof(_root[thisClip]) == "movieclip"){
_root[thisClip].removeMovieClip();
}
}
}
If you want to remove specified MC`s add, condition :
for example:
this removes all MC`s which name starts from "MC"
That`s all...Code:if ((typeof(_root[thisClip]) == "movieclip") && (String(_root[thisClip]._name).substr(0,2)=="MC")){
_root[thisClip].removeMovieClip();
}
ZeroIQ