...

View Full Version : movieclip not disappearing



gani
12-18-2008, 06:46 PM
Please help me

I am loading an external swf into my main movie as follows





loadMovie("helloworld.swf","mymovie");
mymovie.onLoad=function (){mymovie._visible=false;}



the instance name is mymovie... when the helloworld.swf loads i want the movieclip to become invisible.. but it is not working.... see the not working example here
http://www.skenglish.sk/deleteme/mainmovie.swf

why is the helloworld text still there?

itsallkizza
12-18-2008, 07:16 PM
Why not removeMovieClip(this); ?

gani
12-18-2008, 08:01 PM
I do not want the swf to be deleted ... does that function delete the movie or just make it invisible?


Update: tried it ...didnt work

gnomeontherun
12-18-2008, 08:32 PM
mymovie._alpha = 0;

This makes a movie clip invisible.

gani
12-18-2008, 09:14 PM
i do not want the movie just to be invisible...i want it removed from the stage completely ... but i want to load it again later on ... that is why i loaded it in the first place ....



Update: I have attached my two fla files. They are not big, only 3 lines of code. Please help me find out why this is happening

gnomeontherun
12-18-2008, 09:46 PM
Ok, well it helps to be clear about your intentions.

You could always load the item and then hide it by using swapDepth() to place it underneath other movieclips or just use _y and _x to move it off the stage.

gani
12-18-2008, 09:52 PM
Jeremy, Please, if you can, could you take a look at the files that i attached in my previous post . I do not want to solve this problem in another way without first knowing why it is not working just by making the movie clip _visible property to false. Here is an opportunity to learn something new :D

itsallkizza
12-18-2008, 10:17 PM
Actually, your code shouldn't be working for several reasons.

1) Unless you failed to give us the code for "mymovie"'s creation, then "mymovie" doesn't exist. So loadMovie is trying to load your .swf into a null target.

2) Even if the .swf loads (which from your original post, it does), then just logically speaking, setting an onload handler after you load the movie doesn't make sense. As in every script, you need to set up the handlers before the events are fired.

3) I'm not 100% sure, but iirc you can't set an onload that way using the loadMovie function. If you want to set an onload handler, this is the correct way of doing it:


var mc_loader:MovieClipLoader = new MovieClipLoader();
var mc_listener:Object = new Object();
mc_listener.onLoadInit = function(target_mc)
{
target_mc._visible = false;
}
mc_loader.addListener(mc_listener);

_root.createEmptyMovieClip("my_movie",_root.getNextHighestDepth());
mc_loader.loadClip("helloworld.swf",my_movie);

gani
12-18-2008, 10:49 PM
hmm :eek: a lot to take in .. also i found out that when you do a loadmovie the instance name where you are loadin gthe swf to will be erased :( ....

thanks let me look into ...hmm where to start ...:confused:

itsallkizza
12-19-2008, 01:19 AM
when you do a loadmovie the instance name where you are loadin gthe swf to will be erased
That's not true unless you overwrite it with a new target that has the same name.

gani
12-19-2008, 01:39 AM
Please view the files that i attached for a demo that it is true

itsallkizza
12-19-2008, 04:32 AM
Please view the files that i attached for a demo that it is true
I did and it's not true.

Here's your exact code in the fla:


loadMovie("helloworld.swf",mymovie);
_root.mymovie._visible=false;
stop();


First of all you didn't declare a the target before referencing it. Flash is being nice and assuming you want to create a new movie clip called "mymovie" - most languages aren't as lenient as AS2.

Secondly, if you check and see if mymovie is still around after you loadMovie it, it does in fact still exist:


loadMovie("helloworld.swf",mymovie);
_root.mymovie._visible=false;
stop();
trace(mymovie);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum