Loading image name instead of the image
Hi all,
Sorry but i'm a little new to AS3 and flash and have come to an abrupt halt. I have a database (phpMyAdmin 2.6.0-beta2 ) which holds information which i want to display in a flash form so i'm using an XML file to bridge the gap. After building the application in FLASH and running it the text from the database comes through but no the images. Details of what i'm trying to do are as follows:
The XML file
<?php echo "<?xml version='1.0' encoding='ISO-8859-1'?>"?>
<catalogue>
<?php do { ?>
<fish>
<Id><?php echo $row_all_fish['ID']; ?></Id>
<Name><?php echo $row_all_fish['Name']; ?></Name>
<Description><?php echo $row_all_fish['Description']; ?></Description>
<Price><?php echo $row_all_fish['Price']; ?></Price>
<Image><?php echo $row_all_fish['Image']; ?></Image>
</fish>
<?php } while ($row_all_fish = mysql_fetch_assoc($all_fish)); ?>
</catalogue>
<?php
mysql_free_result($all_fish);
?>
The action script part from FLASH
xmlObject = new XML();
xmlObject.onLoad = readMedia;
xmlObject.ignoreWhite = true;
// **************vvvvvvvvvvvvvvvvEdit this bitvvvvvvvvvvvv*********************************
xmlObject.load("http://localhost/fishing/generate_xml.php");
// ***************^^^^^^^^^^^^^^^Edit this bit^^^^^^^^^^^^*********************************************
//
stop();
//
function readMedia(success) {
if (success == true) {
// Root node
rootNode = xmlObject.firstChild;
// id = number of child nodes
sizeOfCollection = rootNode.childNodes.length;
// Current node = first child node
currentNode = rootNode.firstChild;
// Display next car.
drawItem();
}
}
function drawItem() {
// **************vvvvvvvvvvvvvvvvEdit this bitvvvvvvvvvvvv*********************************
Id.text = currentNode.childNodes[0].firstChild;
Name.text = currentNode.childNodes[1].firstChild;
Description.text = currentNode.childNodes[2].firstChild;
Price.text = currentNode.childNodes[3].firstChild;
Image.text = currentNode.childNodes[4].firstChild;
// ***************^^^^^^^^^^^^^^^Edit this bit^^^^^^^^^^^^*********************************************
debug();
}
//
nextFish.onRelease = function() {
nextNode = currentNode.nextSibling;
if (nextNode == null) {
break;
} else {
currentNode = nextNode;
drawItem();
}
};
//
previousFish.onRelease = function() {
nextNode = currentNode.previousSibling;
if (nextNode == null) {
break;
} else {
currentNode = nextNode;
drawItem();
}
};
// Read Greens XML file.
Greens.onRelease = function() {
// **************vvvvvvvvvvvvvvvvEdit this bitvvvvvvvvvvvv*********************************
xmlFile = "http://localhost/fishing/generate_xml.php";
// ***************^^^^^^^^^^^^^^^Edit this bit^^^^^^^^^^^^*********************************************
xmlObject.load(xmlFile);
};
/*
*/
function debug() {
// **************vvvvvvvvvvvvvvvvEdit this bitvvvvvvvvvvvv*********************************
Id = currentNode.childNodes[0].firstChild;
Name = currentNode.childNodes[1].firstChild;
Description = currentNode.childNodes[2].firstChild;
Price = currentNode.childNodes[3].firstChild;
Image = currentNode.childNodes[4].firstChild;
// ***************^^^^^^^^^^^^^^^Edit this bit^^^^^^^^^^^^*********************************************
}
stop();
I can not workout how to display the image itself instead of the files name. Any help anyone can give would be great!
Thanks for your time helping me.
