A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: LoadVars into _root?

  1. #1
    Bob (the singing sock)
    Join Date
    Aug 2000
    Location
    Århus, Denmark
    Posts
    472

    LoadVars into _root?

    I'm changing an action from loadVariablesNum to LoadVars.

    I need to put all the variables from the loadVars object into _root.
    How do I do that?

    regards
    pod

  2. #2
    Senile member! :)
    Join Date
    Dec 2001
    Location
    Saunaswamp (transl)
    Posts
    2,296
    Well you could try it like this(myVars being the LoadVars object):
    Code:
    myVars.onLoad = function(success)
    {
        if(success)
        {
           for(i in this)
           {
               if(typeof(this[i]) != "function")
                   _root[i] = this[i];
        }
    }
    /Mirandir

  3. #3
    Bob (the singing sock)
    Join Date
    Aug 2000
    Location
    Århus, Denmark
    Posts
    472
    thanx a bunch it's perfect - you left out a '}'.

    I came across the 'delete'-operator wich then can delete the now obsolete object loadvars.
    Code:
    ll = new LoadVars();
    ll.load(["texter" + language + ".txt"])
    ll.onLoad = function(success){
    	if(success){
    		for(i in this){
    			if(typeof(this[i]) != "function")
    			_root[i] = this[i];
    		}
    		delete ll;
    	}
    }
    thanx again //pod

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center