Problem with LoadVariables


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


Welcome to kirupaForum, dhiru! :slight_smile:

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:

this.onData = function() {
	trace("Data has been received!");

However, I’d recommend you to use the [font=courier new]LoadVars[/font] object. Check out this tutorial:

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(){