Won't read variable

I have a MC on my stage. It has let’s say a motion tween that covers the stage when you click on a button. At the end of this motion tween we have a loadMovie (it loads a external swf). Then after that we have another motion tween that reveals the stage this time (showing the new swf)

My problem is that I don’t want the animation in the swf to start until the motion tween that reveals the stage is complete.

so what i did was at the end of the motion tween that reveals the stage i put


_global.myFlag=3;

then in the first frame the of movie being loaded i put


stop();
if (myFlag==3) {
    blah blah ...
}

this does not work … anyone know of a different way or why this is not working?

Cheers
Sandman9

:h:


stop();
if (_global.myFlag==3) {
        blah blah ...
}


blah blah is the rest of my script … for example … gotoandPlay(“begin”); … so this tells it to play the movie when myFlag=3 except it does not play

Sandman9

Just a wild guess…
[AS]stop();
m = _parent.createEmptyMovieClip(“temp”, 1000);
m.onEnterFrame = function(){
if(_global.myFlag==3) {
blah blah … ;
delete this.onEnterFrame;
}
}[/AS]

scotty(-:

thanks for the reply’s

Scotty, I do not see how this is applicable? did you read the first post?

If anythings unclear then please let me know

Cheers
Sandman9

Put it on the first frame of the movie being loaded. Your way it’s only checking once, mine keeps on checking till it’s true (at least that is what it should do, i didn’t test it)

scotty(-:

Hello Scotty

I have a preloader script on the first frame of the movie being loaded … so what i did using your script was


this.onEnterFrame = function() {
	//checks to see if the external movie (this) is fully loaded
	if (this.getBytesLoaded()<this.getBytesTotal()) {
		Total = this.getBytesTotal()/1000;
		Received = this.getBytesLoaded()/1000;
		_root.cover.loader.percentage = (Received/Total)*100;
		//tell the progress bar animation (located in the cover mc)
		//to go to a frame between 0 and 100
		_root.cover.loader.bar._xscale = percentage;
	} else {
		//when its fully loaded
		m = _parent.createEmptyMovieClip("temp", 1000);
        m.onEnterFrame = function(){
        if(_global.myFlag==3) {
                gotoAndPlay(2);
                delete this.onEnterFrame;
        }
}
		//tell the cover mc to play its opening animation
		_root.cover.gotoAndPlay("show_mc");
		//turn of the enterFrame action
		this.onEnterFrame = null;
	}
};
stop();

This worked BUT if i click on a different button and then click on the button that loads this same swf again then the animation starts without waiting for the motion tween to finish.

I don’t know if this helps but it’s not exactly a motion tween revealilng the stage. I have a MC that is being attached and then duplicated to cover the stage area. Then in this MC it has a motion tween that reveals part of the stage (at the end of this motion tween i have “_global.myFlag=3;”

Sandman9

I see, it doesn’t work the second time, because myFlag is set to 3. So after you run it the first time you have to reset myFlag. Try:[AS] m = _parent.createEmptyMovieClip(“temp”, 1000);
m.onEnterFrame = function(){
if(_global.myFlag==3) {
gotoAndPlay(2);
_global.myFlag = null;
delete this.onEnterFrame;
}[/AS]

scotty:?)

To read a global variable, you don’t have to place _global in front, only to write them.

Thanks Voetsjoeba, I know;)
With copy and paste it just stayed there…

scotty:?)

Scotty

that seems logical but it did not work … when i click on anothr button and then come back to this one it starts to play before the revealing animation is done … ummmmm

Voetsoeba
I didn’t get what you meant by “only to write them”

Thanks guys
Sandman9

I GOT IT!!! … i just went in and added

_global.myFlag = null;

before the loadMovie command … thanks for all the help Scotty

Sandman9

Pfff, I just wanted to reply to you that I didn’t understand it anymore:D
Good that you worked it out!

scotty(-: