Using Variables and Operators

I’m trying to dynamicly load multiple images to a Movie Clip on the stage. Where I am having trouble, is when I position different sized images one under another.

What I have done is, assign a variable for the position for the _y of the next image.
eg. var spacing:Number = 0;

Since I’m loading the images from a XML file, I’ve included the height for each image aswell. This is where I am having trouble

eg. spacing += myxml.childNodes*.childNodes; OR
spacing = spacing + myxml.childNodes*.childNodes;
trace(spacing);

Say for example, the image I am loading is 400px high, ‘spacing’ then appears to be 0400 and not 400. After I load the second image, which is 500px high, spacing appears to be 0400500 and not 900.

Any help is appreciated, Thank you.
irok

Try using

spacing += parseInt(myxml.childNodes*.childNodes);

You can replace that with parseFloat if you need to use non-integer values.

[quote=Krilnon;1985604]Try using ActionScript Code:
[FONT=Courier New][LEFT]spacing += [COLOR=#0000ff]parseInt[/COLOR]COLOR=#000000[/COLOR];
[/LEFT]
[/FONT]

You can replace that with parseFloat if you need to use non-integer values.[/quote]

Thanks so much Krilnon, it solved my problem!