Global Variable Undefined

Hi folks, here is the set up. I’m working with three files. Main.swf which contains navigation.swf in a blankmc, empty mc called mcContent where navigation sleclected materials are loaded.

In the navigation.fla here is the code
[AS]trace(“now defining global”);
_global.loadFile_str = strPicName;
trace(“global defined as”);


which leads to the trace results of…
[AS]now defining global
global defined as

when i do a trace of loadFile_str in the first frame of monthlyreports i get a undefined. I have tried trace(loadFile_str) and trace(_global.loadFile_str)

I also noticed that if i define the global on the main movie ( it maintains the global variable, the navigation fla will not overwrite it) not sure if that helps anything but i thought i let you know.

Thanks for any help.

It works for me.
i’ve made a movie called navigation.swf and other monthlyreports.swf (as yours =) ) as follows…

// first frame in **navigation.swf**
trace("now defining global");
_global.loadFile_str = "strPicName";
trace("global defined as "+_global.loadFile_str);


// first frame in **monthlyreports.swf**
trace(loadFile_str+" (located in external swf)");

Output window displays…

now defining global
global defined as strPicName
strPicName (located in external swf)

…and all works fine :wink:

sample files below…

Thanks PCMan,

Maybe it was a bugish kind of a thing. Its not the first time i’ve had something work in one file and not in others. I’ll give your files a shot and hopefully it works!

Thanks again

heres a thought…
i got the impression you were trying to set the global variable to a local variable called strPicName
does strPicName actually have a value??
meh… just a thought :wink:


Prophet: yes strPicName has a value something like “home.xml”

PCMan: You attached .swf’s and not .fla’s so I can’t see it working as I want it to.

I still have the problem. Anyone have anyother suggestions? Here is the latest info…3 files. Home, Nav, Content

Home AS Code:
[AS]if (_global.loadFile_str == undefined) {
trace(“default aboutus”)
_global.loadFile_str = “aboutus.xml”;

Nav AS Code:
[AS]Actions.ldmovie = function(strFilePathName){
_global.loadFile_str = strFilePathName;
trace("nav: " + _global.loadFile_str);

Content AS Code:

[AS]trace("Content: " + loadFile_str);[/AS]

Trace output :
[AS]default aboutus
Content: aboutus.xml
nav: directions.xml
Content: aboutus.xml[/AS]