all groups > flash actionscript > october 2004 >
You're in the

flash actionscript

group:

MovieClip _visible and stop()


MovieClip _visible and stop() Todd ScreenName
10/25/2004 9:21:20 PM
flash actionscript:
I am trying to load a movie clip and keep it hidden until I need it. I have
set the _visible variable to false and sent the stop() method to it, but
neither seems to work.

Looking at the documentation, it seems the my_movie._visible variable doesn't
necessarily make it invisible, but it does make it unclickable. Is there an
option to truely hide the swf file so that it is not displayed?

The my_movie.stop() method doesn't seem to be working either. The movie just
keeps playing. Is there a way to get a movie clip to stop playing?

Example code:
var green_mc:MovieClip;
green_mc = createEmptyMovieClip("movie_1", 50);
green_mc.loadMovie("greenCircle.swf"); // works

green_mc._visible = false; // doesn't work
green_mc.stop(); // doesn't work

Re: MovieClip _visible and stop() Todd ScreenName
10/25/2004 10:18:17 PM

[quoted text, click to view]

Because I tried it, but I could still see the movie. Setting _alpha to 0
worked, but setting _visible to false did not have any affect. Below is the
actual ActionScript code. It is in the first (and only) frame. The swift file
keeps playing just fine. Any suggestion on how to hide and/or stop the loaded
movie clip green_mc?


var green_mc:MovieClip;

stop();
green_mc = createEmptyMovieClip("movie_1", 50);
green_mc.loadMovie("greenCircle.swf");
green_mc.stop();
green_mc._visible = false;

Re: MovieClip _visible and stop() Todd ScreenName
10/25/2004 11:53:02 PM
[quoted text, click to view]

Yep. But I am getting closer. The "inactive button" issue was because a some
document I found takjed about making a movie "unclickable" by setting _visible
to false. I misinterpreted this because my movie still seemed to be playing
even though I was setting the variable.

However... I am getting close. I have a multi-frame movie, and I can make the
movie disappear. I think my problem was trying to do this all in one frame. I
will check back in a little later, and hopefully I will have solved it by then.
Re: MovieClip _visible and stop() Todd ScreenName
10/26/2004 12:50:44 AM
Yes!!! Figured it out... I think.

The problem is that calling stop() or assigning _visible too early seems to
cause problem. Here is the basic test:

Frame 1:
var green_mc:MovieClip;

green_mc = createEmptyMovieClip("movie_1", 50);
green_mc.loadMovie("yellow_square.swf");

Frame 2:
green_mc.stop(); or green_mc._visible = false;
these lines have no affect!

However, if I move the same lines to Frame 3, it works!

Frame 3:
green_mc.stop(); or green_mc._visible = false;
It works this time!!!

My guess: I need to make sure the swf file is completely loaded before
assigning to _visible or calling stop().
Re: MovieClip _visible and stop() Jeckyl
10/26/2004 8:07:11 AM
[quoted text, click to view]

That is incorrect .. _visible makes it invisible always. Don't know what
makes you think it doesn't

The problem is that you are stopping the original clip .. but not the one
that is about to load in as a result of the loadMovie.

Re: MovieClip _visible and stop() Jeckyl
10/26/2004 8:28:04 AM
[quoted text, click to view]

You're using it wrong then :) .. where is it in the documentation that it
says the _visible=false doesn't always make things invisible?
_visible = false means the movie is completely invisible and not drawn at
all. ALWAYS prefer _visible=false to setting _alpha=0 if you want the clip
to be not present (not visible, not clickable). Flash PLayer is not vry
good with _alpha=0 .. it still draws the object (but transparently) and due
to bugs and glitches, this can result in 'ghosts' and other visual
artefacts. Be careful with it.

Re: MovieClip _visible and stop() Jeckyl
10/26/2004 11:04:16 AM
[quoted text, click to view]

Funny .. that's what I said :)

AddThis Social Bookmark Button