A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: How to remove child once and not permanently

  1. #1
    Member
    Join Date
    Apr 2014
    Posts
    63

    How to remove child once and not permanently

    I have one button adding a Proloader and using a remove child on my second button to remove the items loaded from the first button. But when I click on the first button again it does not have anywhere to load the Movie into because the childs been removed. Is there a way to clear the child and just remove permanently?

  2. #2
    Member
    Join Date
    Apr 2014
    Posts
    63
    I meant to say a way to clear the child and not remove permanently

  3. #3
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,145
    Put everything in empty movieclip so you can easily reference it.

    For example, this is how I'd manage thumbnail clips - buttons, text, pics, loaded dynamically:

    mcThumbs.mcThumb_0.mcPic

    mcThumbs is an empty clip that holds all the mcThumb clips. mcThumb is a clip that has a pic, text, and a button. It's dynamically generated. mcPic is an empty clip that only holds your loaded pic. Add your loader to it. Then you can removeChildAt(0) because it's the only child.

    mcThumbs.mcThumb_0.mcPic.removeChild(0);

    To clear something from memory, all references have to be cleared. Don't reference the loader in any other way and remove the loader.

    You can reference the clips like this: mcThumbs["mcThumb_" + i].mcPic

    Remember that everything you download to your swf goes in the browser cache (in general) so every time you load the file again, it loads instantly from cache.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center