# Problem with LoadVariables

**URL:** <https://forum.kirupa.com/t/problem-with-loadvariables/59431>\
**Category:** flash\
**Created:** [July 31, 2004, 10:52am UTC](https://forum.kirupa.com/t/problem-with-loadvariables/59431 "2004-07-31T10:52:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhiru](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@dhiru](https://forum.kirupa.com/u/dhiru)\
**Post date:** [July 31, 2004, 10:52am UTC](https://forum.kirupa.com/t/problem-with-loadvariables/59431/1 "2004-07-31T10:52:41Z")

</div>

Hi,

I am using loadvariables in first frame action.

In very first statment i am loading variables and in second statement i want the variable value which is loaded in load variables.

But i get undefined why?

But i get the same value in secod frame.

Please help me

dhiru

---

<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 31, 2004, 5:14pm UTC](https://forum.kirupa.com/t/problem-with-loadvariables/59431/2 "2004-07-31T17:14:51Z")

</div>

Welcome to kirupaForum, dhiru! 🙂

You have to make sure that the variables have been loaded before you attempt to get their values, that’s why you get [font=courier new]undefined[/font].

If you use the [font=courier new]MovieClip.loadVariables()[/font] method, the [font=courier new]MovieClip.onData[/font] event handler will be triggered once that the new data has been received. Example:

```auto
this.onData = function() {
	trace("Data has been received!");
};
this.loadVariables("file");

```

However, I’d recommend you to use the [font=courier new]LoadVars[/font] object. Check out this tutorial: [http://www.kirupa.com/developer/mx/externaldata.htm](http://www.kirupa.com/developer/mx/externaldata.htm).

---

<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 31, 2004, 5:14pm UTC](https://forum.kirupa.com/t/problem-with-loadvariables/59431/3 "2004-07-31T17:14:56Z")

</div>

The variable probably hasn’t finished loading yet…look up “loadVars” in the help that came with flash, then you will be able to use  
myVariable.onLoad = function(){  
trace(myVariable);  
}
