# Global Variable Undefined

**URL:** <https://forum.kirupa.com/t/global-variable-undefined/116330>\
**Category:** Uncategorized\
**Created:** [July 16, 2004, 3:44pm UTC](https://forum.kirupa.com/t/global-variable-undefined/116330 "2004-07-16T15:44:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![strivedi](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@strivedi](https://forum.kirupa.com/u/strivedi)\
**Post date:** [July 16, 2004, 3:44pm UTC](https://forum.kirupa.com/t/global-variable-undefined/116330/1 "2004-07-16T15:44:58Z")

</div>

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”);

```
	trace(_global.loadFile_str);

```

\_root.mcContent.loadMovie(“monthlyreports.swf”);  
[/AS]  
which leads to the trace results of…  
[AS]now defining global  
global defined as  
images/cbookings.jpg  
[/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.

---

<div class="post-metadata">

**Author:** ![strivedi](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@strivedi](https://forum.kirupa.com/u/strivedi)\
**Post date:** [July 28, 2004, 2:43pm UTC](https://forum.kirupa.com/t/global-variable-undefined/116330/2 "2004-07-28T14:43:06Z")

</div>

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”;  
}  
\_root.mcContent.loadMovie(“content.swf”);  
\_root.mcNav.loadMovie(“navigation.swf”);[/AS]

Nav AS Code:  
[AS]Actions.ldmovie = function(strFilePathName){  
\_global.loadFile\_str = strFilePathName;  
\_root.mcContent.loadMovie(“content.swf”);  
trace("nav: " + \_global.loadFile\_str);  
};[/AS]

Content AS Code:

[AS]trace("Content: " + loadFile\_str);[/AS]

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

---

<div class="post-metadata">

**Author:** ![strivedi](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@strivedi](https://forum.kirupa.com/u/strivedi)\
**Post date:** [July 30, 2004, 3:05pm UTC](https://forum.kirupa.com/t/global-variable-undefined/116330/3 "2004-07-30T15:05:31Z")

</div>

bump
