22  08 2007

How to remove all child movieClip through AS 2.0 Code

To remove all child from a given movie clip simple loop through its all object and remove the type of object you want. Following code does the same for related_mc.sp_related name movie clip:

for (obj in related_mc.sp_related){
// root.mc1[obj] instanceof MovieClip same as typeof(_root.mc1[obj])==”movieclip”
    if (typeof(related_mc.sp_related[obj])==”movieclip”){
     related_mc.sp_related[obj].removeMovieClip();
    }
}

this loop through all child of related_mc.sp_related and remove the instance if its of the type “movieclip”.

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Live
  • LinkedIn
  • MySpace
  • Reddit
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz
  • Yigg

Leave a Reply

« »