# Local variables to Global variables....help needed

**URL:** <https://forum.kirupa.com/t/local-variables-to-global-variables-help-needed/56863>\
**Category:** programming\
**Created:** [July 8, 2004, 7:44am UTC](https://forum.kirupa.com/t/local-variables-to-global-variables-help-needed/56863 "2004-07-08T07:44:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elendil](https://avatars.discourse-cdn.com/v4/letter/e/df788c/32.png) [@Elendil](https://forum.kirupa.com/u/Elendil)\
**Post date:** [July 8, 2004, 7:44am UTC](https://forum.kirupa.com/t/local-variables-to-global-variables-help-needed/56863/1 "2004-07-08T07:44:41Z")

</div>

I recive value’s from a php-file into a movieclip called VarClip embedded in root via a submitbutton with this action:  
LoadVariablesNum(“name.php”, \_root.VarClip, “POST”);

The value’s are received there because I have dynamic-text boxes checking them…and they fill with the appropiate values…  
so far so good…  
But I need the values received to be available on a global-level so I can share them with other Clips in my Flash movie as well…  
Is there a way to bind those values to global values when the arrive??  
for exaple when I receive value pName from name.php:  
to do something like to make this received variable global???

\_global.gName = pName

This doesn’t seem te work though…

please help…someone…

thnx a million.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 9, 2004, 4:01am UTC](https://forum.kirupa.com/t/local-variables-to-global-variables-help-needed/56863/2 "2004-07-09T04:01:11Z")

</div>

\_global or global $var ?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 9, 2004, 6:41am UTC](https://forum.kirupa.com/t/local-variables-to-global-variables-help-needed/56863/3 "2004-07-09T06:41:39Z")

</div>

I just need the vars to be global, so they are accessible for every MovieClip in every timeline on every level…

I’ve tried serveral ways but nothing seems to work…  
I origanally receive those value’s from a php -file and want to make them global…

Can you tell me how?  
I’ve tried to make a container and want to load them into but the command

sendContainer.sendAndLoad(“name.php”, loadContainer)

doesn’t seem to load them into loadContainer at all…???

But I’ll put in a post where I’ll upload my whole code so you can have a better Idea what i’m doing…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 9, 2004, 7:01am UTC](https://forum.kirupa.com/t/local-variables-to-global-variables-help-needed/56863/4 "2004-07-09T07:01:17Z")

</div>

Back again, here’s my code:

The whole thing has 3 frames,  
I’ve got 2 inputtextboxes and a submit button in the first frame:

input-text userinput which gives var: user  
input-text passinput which gives var: pass  
submitbutton  
…  
In the first frame I’ve got this action

stop();  
userinput.restrict=“a-zA-Z0-9”;  
Selection.setFocus(userinput);  
passinput.restrict=“a-zA-Z0-9”;  
status=“Enter your information and submit”;  
this.onEnterFrame = function () {  
//vanaf hier is het spannend  
if($checklog == 1){  
\_root.gotoAndStop(2);  
}  
if($checklog == 2){  
\_root.gotoAndStop(3);  
}  
}

…  
On the submitbutton I’ve got this action:

on (release, keyPress “\<Enter\>”) {  
if (user != “” && pass != “”) {  
// Create varcontainers  
sendContainer = new LoadVars();  
loadContainer = new LoadVars();

```
 // Set vars
 sendContainer.username = user;
 sendContainer.passwrd = pass;
 status = "Begin Login Process - Wait...";
 //textbox01 = sendObject.username;
 //textbox02 = sendObject.passwrd;
 
 // Start connection
 sendContainer.sendAndLoad("newlogin.php", loadContainer);
 
 checklog = loadContainer.checklog;
 }

```

}  
…  
The reason I want to do this, is that I want to let the user loggin once, but immediately retreive all his/her data from the server, which i can then use later on in the movie…(color prefs, location, male/female info etc.etc)  
Thats why I want them to go into global variables so I can do that…

Hope you understand me so you know what i’m trying to accomplish, my english is not that good…

Thnx a million
