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
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.
_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 :
<myXML>
<rect x="300" y="200" w="100" h="400" />
</myXML>
I parse it like this…
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.