# \[F8\] Using external varibles and if-statement. Please Help

**URL:** https://forum.kirupa.com/t/f8-using-external-varibles-and-if-statement-please-help/282375
**Category:** flash
**Created:** [February 20, 2009, 11:49pm UTC](https://forum.kirupa.com/t/f8-using-external-varibles-and-if-statement-please-help/282375 "2009-02-20T23:49:22Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Sketchbookshark](https://avatars.discourse-cdn.com/v4/letter/s/848f3c/32.png) [@Sketchbookshark](https://forum.kirupa.com/u/Sketchbookshark)
#### Post date: [February 20, 2009, 11:49pm UTC](https://forum.kirupa.com/t/f8-using-external-varibles-and-if-statement-please-help/282375/1 "2009-02-20T23:49:22Z")

</div>

Hi everyone,

I am trying to control some of the global variables in my script through an external text file. Is that possible?

I have a variable called "\_global.scrollOrNot, which determines whether I want flash to use the text window with a scroll-bar or the one without a scroll-bar. I am trying to control that through an external text-file called “ScrollCommand.txt”. Here is my code:  
**frame1:**

\_global.scrollOrNot;

**frame2:**

sbScroll = new LoadVars();  
sbScroll.load(“ScrollCommand.txt”);  
sbScroll.onLoad = function(success) {  
if (success) {  
\_global.scrollOrNot = sbScroll.sb1WindowScroll;  
}  
};  
\*\*frame3:  
\*\*trace(\_global.scrollOrNot);  
//this works wonderfully and traces “yes”, exactly as is in my external txt

**frame4:**  
if (\_global.scrollOrNot == “yes”) {  
\_root.attachMovie(“MC\_TextFeldSB1”, “sbBodyField\_mc”, 10, {\_x:12, \_y:32});  
} else {  
\_root.attachMovie(“MC\_TextFeldSB1noscroll”, “sbBodyField\_mc”, 10, {\_x:12, \_y:26});  
}

//this is were I have a problem. :puzzled: It will always choose “MCtextFeldSB1noscroll”. I have tested the whole thing with other variables, which were not changed by any LoadVars function and it works just fine then. As soon as I change the variable using the LoadVars function it will not work any more. Can anybody help?
