unload/load movie

  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

I have a test flash website (im just playing around with it). Now on a movie instance i have a empty movie clip named 'content' which i load external movies on.

In that movie instance i have another movie instance within that which is an animated navigation bar.

So it will be like:


navigation bar
^^
content area
^^
MAIN MOVIE


On the navigation bar link i am trying to make sure that when a button is clicked, a new movie loads on the 'content' instance.

Currently i use:

Code: [ Select ]
loadMovie("content_name.swf","content");


However, when it comes to the navigation bar i try:

Code: [ Select ]
on(release) {
unloadMovie("content");
}
  1. on(release) {
  2. unloadMovie("content");
  3. }

... but the above codes does not unload the content movie.


So then i try:

Code: [ Select ]
on(release) {
_root.unloadMovie("content");
}
  1. on(release) {
  2. _root.unloadMovie("content");
  3. }

The above unloads the whole swf file so i end up with blank screen.


Then i went on to...
Code: [ Select ]
on(release) {
_parent.unloadMovie("content");
}
  1. on(release) {
  2. _parent.unloadMovie("content");
  3. }

... the above just unloaded the navigation bar.



Any suggestions?[/code]
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

Try content.unloadMovie();

That should work.

And if you load another movie to that clip, it will automatically unload whatever is loaded to it at that time, so there is no need to unload the content before loading new content... in case that is what you were trying to achieve.
  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

That is exactly what i am trying to achieve. However, when i load another movieclip, the previous movie clip on that frame still exists. So really they are overlaping.

Now when i try to unload the movie using:

content.unloadMovie();

it does not work at all.
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

Um, are you loading to 2 seperate clips? Because this has never happened to me.

How are you creating the content clip? Is it created manually, or through actionscript?

What is the actionscript code you are using to load the movie in? I noticed a lot of people combine loadMovie() and loadMovieNum() into a loadMovie() statement, which can cause problems.

loadMovie() is to load a movie to a movieclip symbol and is written as mcInstance.loadMovie("file.swf");

loadMovieNum() is to load a movie to a level and is written as loadMovieNum("file.swf", level#);

However, I see a lot of people trying to write mcInstance.loadMovie("file.swf", level#), which is contradictory and may cause flash to get confused.
  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

ok i fixed the issue.

Because i have movieclips within movieclips i did this:

unloadMovie("_root.movieclip.content");


then it worked. I have to work my way up until i could reach the content movie clip.
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

Oh, so it was just a targeting issue then.
  • dhonsvick
  • Beginner
  • Beginner
  • dhonsvick
  • Posts: 49

Post 3+ Months Ago

I know this is resolved, but just for others that might frequent this site from google heres a little script that will destroy a movie clp once it has hit a specific part of the screen

function removeClip(remove_clip:MovieClip,pos:Number):Void{
remove_clip.onEnterFrame = function(){
if(remove_clip._x == pos){
remove_clip.swapDepths(1048575);
removeMovieClip(remove_clip);
delete this.onEnterFrame;
}
}
}

Note, the swapping of Depths, You have to do this to properly remove some clips, especially ones drawn by hand in flash.
  • LongHairRkr
  • Newbie
  • Newbie
  • LongHairRkr
  • Posts: 13

Post 3+ Months Ago

I'm sure you have your site up and running just fine by now ... BUT I wanted to add a little something I have figured out from tinkering and other comments and questions on here.


What you're doing seems to be long hand for something. I have found that the easiest way to do this is this:

on putting the clip into your content area, all you should have is:

loadMovie("context_name.swf", 1);


this loads that movie into level one UNDER your MAIN movie ... which you should be loading into level 2 of the "navigation bar" movie via

loadMovie("MainMovie.swf", 2);

and THEN ... when you hit your button to change the content, all you have to do is code the button thusly:

on (release){
unloadMovie(1);
}

which will TOTALLY undo the movie on the content level.

OR

you can also just use ANOTHER loadMovie command targetting the same level (1) to unload the one already there and replace it with a new content movie.


Just seems much simpler that way, my site has five levels and it gets REALLY tricky then.

Or I could be totally wrong. LMAO!

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 22 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.