PDA

View Full Version : dynamic _x _y values from xml



mx_kid
November 17th, 2005, 09:25 AM
hi there ive searched but cant find the answer to this -

ive got some dynamic _x _y values coming from an xml file, and i can trace these out fine. xml_x = 300 xml_y = 240 or whatever.

However when I try to send a mc to those values, using either load either or enterFrame the clip doesnt do anything at all.

Is this because flash is treating the 300 from <xpos>300</xpos> in my xml file as a string rather than an integer?

cheers
g

Mirandir
November 17th, 2005, 10:22 AM
Shouldn't matter as long as there isn't any "trash" characters like linebreaks or space in the string.

What syntax do you use to assign the position to the movieclips _x and _y properties?

/Mirandir

mx_kid
November 17th, 2005, 10:27 AM
hi thanks for your reply

in using



onClipEvent(load){
gotoAndStop(1);
this._x = _parent.myvar_x;
this._y = _root.myvar_y;
}


the scene has two frames, when the xml is loaded it goes to frame 2 where the mcs are located (i used a _parent and _root for testing, would usually use _parent)

mathew.er
November 17th, 2005, 11:35 AM
If content of myvar_x is a string, you can convert it to a numbyr with Number() function... then you would use: this._x = Number(_parent.myvar_x);

edit: but even if you assign i.e. string "400" and not a number as _x position it shloud work...