PDA

View Full Version : passing class to xml


phingko
10-24-2009, 11:22 AM
All wise people out there!!
screaming for help from a desperate student

I am making a game project using tiles.
I want to ask bout the xml.

I know how to load an xml data into the stage by using one class from library

However, rite now, I have 3 customer_mc with class for each:
char1,char2,char3

And i have this xml data called customer_xml that contents the customer name,order and payment.
So far i know how to call one class and do a for loop but i cant find a way to call three classes and put it into the for loop.


function init(xmlString:String):void {
customer_xml = new XML(xmlString);
for (var i:uint = 0; i<customer_xml.customer.length(); i++) {
var customer_mc:char1= new char1();
customer_mc.y = Math.random()*stage.stageHeight;
customer_mc.x = Math.random()*stage.stageWidth;
addChild(customer_mc);
customer_array.push(customer_mc);

}
}

The questions are:
how can i put three customer mc into the for loop? Do I put it in an array? Do you mind give me an example?

Second, I don't want it to be put randomly on the stage but only on the right corner of the stage. Is that mean, I put a precise coordinate for the customers mc?

Thanks in advanced