Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

global variable not visible in child movie clip

Status
Not open for further replies.

kdelacruz

Technical User
Oct 7, 2002
25
0
0
ES
Hello -
I have read numerous posts on this subject, and have tried all the advice I've seen, but nothing has helped.
I hope someone can tell me what I'm doing wrong!

My .fla files are at
I have a bunch of swfs that I want the user to choose between playing one by one (this part works), or play all one after another automatically.
If they play the swfs (these will all be played in html files in a web browser) one by one, at the end of each swf I have a getURL command that closes the html window.
This works fine.
BUT for the PlayAll option, I have made new swf file (mymainmovie.fla) to contain the child swfs playing in turn. I have an array containing all the swf filenames to play.

So as not to have to make 2 versions of each swf file (one for playing & exiting, and another for playing & then playing the next one in line), in the main swf I have a global variable:
Code:
_global.playall = "yes";
(will be yes if all swfs should play; will be no or undefined if the user is just playing one by one -- if one by one I will not even use this main movie)

In the last frame of each child swf, I have this code to see if it should close the window or go back to the parent, based on that global var (the problem is that it can't see that var!):
Code:
if(_parent.playall == "yes")
{
	stop();
	_parent.ClipDone = "yes";
	_parent.gotoAndPlay(2);
}
else
{	
	getURL("window_closer.htm", "_self");
}
I've tried replacing "_parent" in the child swf with "_root", "_level0" and have tried just referencing "playall" alone, but I can't get it to see that variable!
On the other hand, I have no problem setting variables in the parent movie ...
Code:
_parent.ClipDone = "yes";
works fine.

I hope someone can help me!!

Thanks,
Kathy
 
should this not be

if(_global.playall == "yes")


and not parent
 
THANK YOU!
That does indeed work!
Somehow I thought I had tried that too, some time back, but I guess not... I feel so silly! [dazed]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top