# Data types (I think ?)

**URL:** <https://forum.kirupa.com/t/data-types-i-think/220449>\
**Category:** Uncategorized\
**Created:** [March 26, 2007, 3:17pm UTC](https://forum.kirupa.com/t/data-types-i-think/220449 "2007-03-26T15:17:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zellers](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/zellers/32/3135_2.png) [@zellers](https://forum.kirupa.com/u/zellers)\
**Post date:** [March 26, 2007, 3:17pm UTC](https://forum.kirupa.com/t/data-types-i-think/220449/1 "2007-03-26T15:17:03Z")

</div>

I have a question that is causing a serious problem. It has to do with classes, data types( I think?) and

data from XML.

Lets say I have the following function IN A CLASS FILE

```auto

    public function RectangleTile(cx:Number, cy:Number, rw:Number, rh:Number) {
        
        super(cx,cy);
        rectWidth = rw;
        rectHeight = rh;    
        createBoundingRect(rw, rh);
    }

```

Right… ok so I create a new instance of it with the variables that are to be passed to it.

```auto

_root.engine.addSurface (new RectangleTile (300, 200, 100, 400));

```

Ok, this works as expected, and does EVERYTHING I want it to do (properly) but…

If i take data from an XML file such as this :

```auto

<myXML>
    <rect x="300" y="200" w="100" h="400" /> 
</myXML>

```

I parse it like this…

```auto

var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function() {

    trace ("test") //It outputs this
    with (_root) {
        x = myXML.firstChild.firstChild.attributes.x;
        y = myXML.firstChild.firstChild.attributes.y;
        w = myXML.firstChild.firstChild.attributes.w;
        h = myXML.firstChild.firstChild.attributes.h;

        this.engine.addSurface (new RectangleTile(x,y,w,h)); /*

  THIS DOES NOT WORK FOR SOME REASON!!

*/
    }
}
myXML.load ("xmlFile.xml");

```

So really, my question is, is there anything different about the variables parsed in XML, and the

variables that are just defined in \_root ?

My guess is maybe the data-types, cause on the function in my Class file, i was using strict data-typing.

It works when i just call the function in \_root, by just entering numbers, but when i use variables

parsed from XML, it doesnn’t do anything.

If anyone knows what data-type that I would be dealing with, it would be a great help.

Also… I am not even sure if data-typing is my problem ☹

Thanks in advance for any help, I won’t be on for about 8-10 more hours.
