Problem with using loaded variables as movie clip properties

Hello,

i’ve got a php searchroutine that prints out unique url encoded objectnames and coordinates that are corresponding to instances of movieclips in my flash movie.

i.e. there are the

variables “objectname” and “xcoordinate”

that are imported into the movie using loadvariablesnum.
this seems to work, at least i am able to fill a textfield within the movie with this value correctly.

But i fail if as soon as i want to use this variable valued for i.e. the definition of movie clip properties etc.

if i use

_root[objectname]._x = 300;

simply nothing happens at all.

_root[objectname]._x

seems to be 0 if i try to print it to a textfield.

another case is

_root.movieclip._x = xcoordinate;

xcoordinate can be printed to a textfield but there’s no effect after the abvoe quoted routine.

any clue what i am doing wrong ? Is the syntax correct and is it basically possible to use imported variables for naming objects this way ?

I’m looking forward to any hint.
Sorry for my lame english but i’m from Germany.
This is a great site by the way !
thank you in advance

Oliver

mx has a new object: LoadVars. you can use this object to help manage loading external variables.

for instance, let’s suppose you have an external file containing variables. it’s named “vari.txt” and contains this:

mc=sqr&x=300&y=300

in your flash file, you have a movie named “sqr” which you want to be positioned according to the text file. you might write something like:

 
loader = new LoadVars();
loader.load("vari.txt");
loader.onLoad = function(){
   _root[this.mc]._x = this.x;
   _root[this.mc]._y = this.y;
}

this way, the onLoad event will ensure that the variables have loaded before executing the actions that call on them. note that all the variables are contained within the LoadVars object. also note that “this” refers to loader in the function.

now you can change which movie is moved to where by changing the text file.

great, this really works !

don’t know what was wrong with this loadvariablesnum stuff but now that’s it …

thanks a lot !