columns xml to flash - as3

i am creatign a list from an xml file in flash and i wanted to know how do i go about having it display in two columns in stead of one repeating column in flash. here is my code


import com.greensock.events.*;
import com.greensock.loading.*;
import com.greensock.*;
import flash.display.Sprite;
import flash.display.MovieClip;

var loader:XMLLoader = new XMLLoader("../xml/buggies.xml", {name:"buggies", onComplete:completeHandler});
loader.load();

function completeHandler(event:LoaderEvent):void {
	var xml:XML = event.target.content;
	var xmlItems:XMLList = xml.buggies;
	var yPosition:Number = 30;
	var xPosition:Number = 8;
	for each(var xmlItem:XML in xmlItems) {
		var item:buggieItem = new buggieItem();
		addChild(item);
		
		item.condition.text = xmlItem.condition[0].text();
		item.model.text = xmlItem.model[0].text();
		item.features.text = xmlItem.features[0].text();
		item.salePrice.text = "$" + xmlItem.salePrice[0].text();
		item.image.text = xmlItem.image[0].text();
		item.y = yPosition;
		item.x = xPosition;
		yPosition += 240;
	}
}

Open in new window

chefkeiferAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CyanBlueCommented:
What do you mean by 'two columns'???

Can you also post the XML file and the buggieItem class???

CyanBlue
0
deepanjandasCommented:
@CyanBlue, I guess @chefkeifer is looking for how to display the data in 2 columns.

@chefkeifer, try this with your code:
var columns:int = 2;
var xPos:int = 0; 
var yPos:int = 0; 
var counter:int = 0;

var item:buggieItem;

for each(var xmlItem:XML in xmlItems) {
     item = new buggieItem();
     addChild(item);
     item.condition.text = xmlItem.condition[0].text();
     item.model.text = xmlItem.model[0].text();
     item.features.text = xmlItem.features[0].text();
     item.salePrice.text = "$" + xmlItem.salePrice[0].text();
     item.image.text = xmlItem.image[0].text();
     item.x = xPos;
     item.y = yPos;

     counter++;
     if ( counter > ( columns - 1 ) ) {
          counter = 0;
          xPos = 0;
          yPos += 240;//item.height;
     } else {
          xPos += 200;//item.width;
     }
}

Open in new window


Warm Regards
Deepanjan Das
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.