squemish

Author Topic: How do I remove a movie clip from main timeline  (Read 1618 times)

ladyrider12

  • Guest
How do I remove a movie clip from main timeline
« on: February 24, 2013, 06:23:25 am »
Hi Everyone,

I am calling a movie clip into my main timeline by using the following code:

stop();

// Create a new MovieClip
var mySlide1:MovieClip = new welcome_mc();

// Add the new MovieClip to the MainTimeline
addChild(mySlide1);

// Set the location of the new MovieClip
mySlide1.x = 668;
mySlide1.y =465;

mySlide1.gotoAndPlay(1);

It is on a page of a website, and only 1 page, it plays well, but it does not go away when you click on another page. I also need it to loop on the page it resides on.

Thanks,
Tammy

dudelively

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 207
  • Dr. Dude
Re: How do I remove a movie clip from main timeline
« Reply #1 on: February 25, 2013, 07:11:42 am »
I typically create a container that I load new content into. Then using something like the following I can purge it before any new content is added.

      while (j -- )
      {
         trace('before : '+container.numChildren);
         container.removeChildAt(j);
         trace('after : '+container.numChildren);
      }
•••••••••••••••••••••••••••••••••••
Dr. Dude
Jason Dude Lively
•••••••••••••••••••••••••••••••••••

ladyrider12

  • Guest
Re: How do I remove a movie clip from main timeline
« Reply #2 on: February 25, 2013, 03:44:14 pm »
Thank you, I will try that.

dudelively

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 207
  • Dr. Dude
Re: How do I remove a movie clip from main timeline
« Reply #3 on: February 26, 2013, 06:57:44 am »
Glad to help.
Keep in mind that you can even add subcontainers to containers. The code above could be used to clear either one.
•••••••••••••••••••••••••••••••••••
Dr. Dude
Jason Dude Lively
•••••••••••••••••••••••••••••••••••