# Using a variable - Basic Q

**URL:** <https://forum.kirupa.com/t/using-a-variable-basic-q/148220>\
**Category:** Uncategorized\
**Created:** [May 18, 2005, 3:07am UTC](https://forum.kirupa.com/t/using-a-variable-basic-q/148220 "2005-05-18T03:07:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jman](https://avatars.discourse-cdn.com/v4/letter/j/b487fb/32.png) [@Jman](https://forum.kirupa.com/u/Jman)\
**Post date:** [May 18, 2005, 3:07am UTC](https://forum.kirupa.com/t/using-a-variable-basic-q/148220/1 "2005-05-18T03:07:12Z")

</div>

[font=verdana, arial, helvetica][size=2][color=#4f5044]Hi,

Firstly, thanks for reading. I don’t know what I’d do without this forum. It is a blessing to say the least.

Anyways, I am relatively new to actionscript and am trying to understand a couple of fundamentals. The main one being-

\*\* What happens to a variable that is loaded into an MC but isn’t connected to a text box of any sort?\*\*  
and  
**How can I reference this variable?**

I have an MC which loads some variables from a text file into several duplicated MCs on the stage. This works fine, however each duplicated MC has a button in it which I would like to get a new URL in a blank window based on a variable called ‘u’ located in the corresponding text file.

To this end, I have attached the following code to the button (granted it’s probably not the best way to do it)-

[/color][/size][/font]  
[indent][font=verdana, arial, helvetica][size=1][color=#4f5044]code:[/color][/size][/font]on (release) {  
getURL (“[http://www](http://www).” add u, “\_blank”);  
}  
[/indent][font=verdana, arial, helvetica][size=2][color=#4f5044]

I have tested it by declaring the variable and it’s value in the first frame of the MC and it works fine but as soon as I delete this declaration so that it will use the value from variable ‘u’ in the text file but it fails.

Can anyone shed any light on this? I would be most appreciative.

Thanks in advance,  
Jman[/color][/size][/font]
