# Using Variables and Operators

**URL:** <https://forum.kirupa.com/t/using-variables-and-operators/205088>\
**Category:** flash\
**Created:** [October 26, 2006, 12:45am UTC](https://forum.kirupa.com/t/using-variables-and-operators/205088 "2006-10-26T00:45:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![irok](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/irok/32/2660_2.png) [@irok](https://forum.kirupa.com/u/irok)\
**Post date:** [October 26, 2006, 12:45am UTC](https://forum.kirupa.com/t/using-variables-and-operators/205088/1 "2006-10-26T00:45:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)\
**Post date:** [October 26, 2006, 12:54am UTC](https://forum.kirupa.com/t/using-variables-and-operators/205088/2 "2006-10-26T00:54:48Z")

</div>

Try using

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

```

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

---

<div class="post-metadata">

**Author:** ![irok](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/irok/32/2660_2.png) [@irok](https://forum.kirupa.com/u/irok)\
**Post date:** [October 26, 2006, 1:01am UTC](https://forum.kirupa.com/t/using-variables-and-operators/205088/3 "2006-10-26T01:01:54Z")

</div>

[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!
