# Problem with LoadVariables

**URL:** <https://forum.kirupa.com/t/problem-with-loadvariables/117888>\
**Category:** Uncategorized\
**Created:** [July 31, 2004, 10:52am UTC](https://forum.kirupa.com/t/problem-with-loadvariables/117888 "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/117888/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:** ![kode](https://avatars.discourse-cdn.com/v4/letter/k/97f17d/32.png) [@kode](https://forum.kirupa.com/u/kode)\
**Post date:** [July 31, 2004, 5:14pm UTC](https://forum.kirupa.com/t/problem-with-loadvariables/117888/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:** ![paradox244](https://avatars.discourse-cdn.com/v4/letter/p/f1d935/32.png) [@paradox244](https://forum.kirupa.com/u/paradox244)\
**Post date:** [July 31, 2004, 5:14pm UTC](https://forum.kirupa.com/t/problem-with-loadvariables/117888/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);  
}
