Hi Guys,
I keep having a problem with loading XML data into a ScrollPane.
Let me break it down:
I have a content clip which loads XML data (from an external source) in a container clip which is linked in my library. And this, the container clip, is loaded in a ScrollPane.
I have written a function that loads the XML and if that works, break down the result array in bits so i can use it to populate dynamic text boxes and a movieclip with a image. (I check to see if the XML is loaded by tracing the XML file, and that works).
The problem lies here; it does not break up the array and does not populate my dyn. txt boxes. Does not give me any errors, it just shows a blank ScrollPane.
This is the code:
ActionScript Code:
xmlInfo = new XML();
xmlInfo.onLoad = xmlLada;
xmlInfo.load("");
xmlInfo.cacheBuster = new Date().getTime();
xmlInfo.load("http://localhost/feeder.php?bit=0");
// Exec. function when XML is loaded
function xmlLada(succes) {
if (succes) {
// If all works
trace(xmlInfo);
//
xmlNode = this.firstChild;
var xPos = 2.0;
var yPos = 2.0;
//For loop to fill container MC with Array data
for (i=0; i < xmlNode.childNodes.length; i++) {
//attach the container clip
mc = this.attachMovie("container", "new"+i, i, {_x:xPos, _y:yPos});
//increase the y postion each time
yPos += mc._height+5;
//add the information
caseID[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue; // Case ID
client[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue; // Client
product[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue; // Product
pictureRect[i] = xmlNode.childNodes[i].childNodes[9].firstChild.nodeValue; // Picture Rectangle
mc.caseID.text = caseID[i][0];
mc.client.text = client[i][1];
mc.product.text = product[i][2];
mc.picta_mc.loadMovie(pictureRect[i][9], this["new"+1].picta_mc);
trace(pictureRect);
}
} else {
// **** hits the fan
}
}
And the XML looks like this:
ActionScript Code:
<xml version="1.0" encoding="UTF-8">
<case_id>1</case_id>
<client>Testing</client>
<product>A Product</product>
<description>This is a test with Case_ID 1</description>
<date>2005</date>
<url>http://www.nu.nl</url>
<videofile>/assets/video/case_nu.flv</videofile>
<picture_thumb>assets/img/case_nu_thumb.jpg</picture_thumb>
<picture_full>assets/img/case_nu_full.jpg</picture_full>
<picture_rect>assets/img/case_nu_rect.jpg</picture_rect>
</case>
</xml>
I did a test with a normal Array, loading data from there, and breaking it up exactly the same way (and same code) and that works fine. I see a nice ScollPane with all the text and images
Can somebody please help me with this ?? I've been trying for two days now and my head hurts...
(I can post the FLA if someone is interested)
Thanks, in advance for your help,
Sidney