Jump to content
Search Community

first node not showing properly

chefkeifer test
Moderator Tag

Recommended Posts

I am wondering why when the first node which is this

item.title.text = xmlItem.title[0].text();

is in there causes an error and they overlap as well...not sure how to word that..

 

but when i comment that out all works just fine..the movieclip loops and with all the data from the xml work just.

 

i have attached a working fla file

 

i am also trying to figure it out how to get these to show up in two columns and not one continueous column

 

thanks for your help

 

http://

http://www.nicholsbuggies.com/greensock ... uggies.zip

Link to comment
Share on other sites

your xml is malformed.

 

some of the nodes are missing nodes and this is causing a runtime error and placing a buggieItem on the stage at x:0 ,y :0 and is covering up the first buggieItem which is in fact displaying correctly.

 

the malformed buggie items start with the buggie with NUMBER 5

 

to form multiple columns update xPosition once a certain number of items have been displayed.

 

Carl

Link to comment
Share on other sites

thanks carl, that was a big help and stupid oversight on my part. As always it the little things that stump yor the longest time.

 

I also figured out the columns with the following code

just for future reference

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 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.title.text = xmlItem.title[0].text();
	 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 += 210;//item.height;
	 } else {
		  xPos += 545;//item.width;
	 }
}

 

i am still need of some help if you dont mind. I need to know how to get the image to show up in each of them as well...

 

i understand the xml part but i am not sure how to get that info from xml with just the dataLoader..do i need to do another imageLoader to get that to happen?

Link to comment
Share on other sites

the url to your images is in

 

xmlItem.image.text();

 

you could add all those urls to an array and then pass that into LoaderMax.parse(myImages);

 

http://www.greensock.com/as/docs/tween/ ... tml#parse()

 

 

OR even easier may be to just to build ImageLoaders in your loop through the buggie items with the proper url and container to load into.

then append each ImageLoader into a LoaderMax queue like on:

http://www.greensock.com/as/docs/tween/ ... oader.html (see the first code example)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...