Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
bluebill1049

Loads XML and then loads all images

Recommended Posts

Hi,

 

i am very new to greensocks loader.

 

i have load this XML and would like to loads all the images.

 

var productXmlLoader:XMLLoader = new XMLLoader(_XMLDIR + productCate + 'Products.xml', {

onComplete:xmlCompleteHandler,

estimatedBytes:50000

});

 

private function xmlCompleteHandler(e:LoaderEvent):void{

_categoryChildren = e.target.getChildren();

//trace(_numberOfXmlChildren);

for(var i = 0; i <_categoryChildren.length; i++){

did trace _categoryChildren return me with a loader i think, but i dont know how to add them to the stage.

is there a way you can go like addChild(******)

}

}

Link to comment
Share on other sites

I think something is wrong with your concept. Try this instead:-

 

public var tmpXML:XML;
private var tmp_name_Attributes:Array = new Array();
private var name_Attributes:XML = new XML();
private var tmpXML_Attributes:XMLList = new XMLList();

public function ConstructurNamePutHere() 
{
loader = new XMLLoader("UrXMLFileName.xml", {name:"whatEverNameHere_xml", onComplete:completeHandler, estimatedBytes:5000});
loader.load();
}

public function completeHandler(event:LoaderEvent):void 
{
tmpXML = new XML(LoaderMax.getContent("whatEverNameHere_xml"));
var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler_SWF, onError:errorHandler});
tmpXML_Attributes = tmpXML.LoaderMax.BottomPanel.SWFLoader.attribute("ButtonInstanceName");

i = 0;
j = 0;

for each (name_Attributes in tmpXML_Attributes) 
{
	//trace("name_Attributes: " + String(name_Attributes));
	tmp_name_Attributes[i] = String(name_Attributes);
	i++;
}

var tmpXML_URL_Attributes:XMLList = tmpXML.LoaderMax.SWFLoader.attribute("url");
for each (var url_Attributes:XML in tmpXML_URL_Attributes) 
{
	queue.append( new SWFLoader( String(url_Attributes), { name:String(tmp_name_Attributes[j]) } ) );
	j++;
}

queue.load();
}

public function completeHandler_SWF(event:LoaderEvent):void 
{
  //trace(event.target + " is complete!");	
}

 

To retrieve the content

public function retrieve_Content(tmpStr:String):Object
{
return LoaderMax.getContent(tmpStr);
}

 

here your xml example

<?xml version = "1.0" encoding = "utf-8" ?>




CHILDCONTENTHERE


CHILDCONTENTHERE




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.
×