Question
XML..: Problem getting the data in the XML-file..
I'm developing a flash-file for my customer to use when
displaying list of products he's selling.
His list of products is inside a XML-file and he want me to display an overview of the products inside a datagrid, so when you click on the product you're interested in the productinfo will be displayed.
But.. I'm having problems grabbing the data I want as it seems to me that I have to use the unik ID's for each products to get the data I want. I've tried adding the unik ID-code to my action script but it still won't work.
Here's a part of the XML-code:
<Tooldata>
<Store name="N/A" zipcode="0033450" city="N/A" url="N/A" phone="N/A" fax="N/A" email="N/A">
<Tool unikID="5_0022" control="14" cmnd="update">
<Toolgroupe>Hammer</Toolgroupe>
<Brand>Knipps</Brand>
<Model>K55_Knipps</Model>
<Price>35€</Price>
<Weight>N/A</Weight>
<Soldout>0</Soldout>
<Color>Red/Black</Color>
<Images>
<Images image="5_0022.jpg" prioritet="1" gen_id="16" desc="MainImage"/>
<Images image="5_0022_1.jpg" prioritet="2" gen_id="16" desc="Image 1"/>
<Images image="5_0022_2.jpg" prioritet="3" gen_id="16" desc="Image 2"/>
<Images image="5_0022_3.jpg" prioritet="4" gen_id="16" desc="Image 3"/>
</Images>
Now, the code above is only one item/product. But there are several proucts listed in the XML-file and I find it hard to get the product and the product info that I want to be displayed.
Here's my action script:
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("ToolData.xml"));
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
ParseBildata(xmlData);
}
function ParseTooldata(TooldataInput:XML):void {
trace("XML Output");
trace("------------------------");
trace(TooldataInput.Store);
}
If I want to trace the images I just write "trace(TooldataInput.Store.Images);
But if I want to trace one unik tool it's impossible. Well, maybe not impossible.. I just don't know how to do just that.
When you trace (TooldataInput.Store); you get all the tools at that store. But how do I trace only one tool using the unikID??
Thanks a lot in advance!
His list of products is inside a XML-file and he want me to display an overview of the products inside a datagrid, so when you click on the product you're interested in the productinfo will be displayed.
But.. I'm having problems grabbing the data I want as it seems to me that I have to use the unik ID's for each products to get the data I want. I've tried adding the unik ID-code to my action script but it still won't work.
Here's a part of the XML-code:
<Tooldata>
<Store name="N/A" zipcode="0033450" city="N/A" url="N/A" phone="N/A" fax="N/A" email="N/A">
<Tool unikID="5_0022" control="14" cmnd="update">
<Toolgroupe>Hammer</Toolgroupe>
<Brand>Knipps</Brand>
<Model>K55_Knipps</Model>
<Price>35€</Price>
<Weight>N/A</Weight>
<Soldout>0</Soldout>
<Color>Red/Black</Color>
<Images>
<Images image="5_0022.jpg" prioritet="1" gen_id="16" desc="MainImage"/>
<Images image="5_0022_1.jpg" prioritet="2" gen_id="16" desc="Image 1"/>
<Images image="5_0022_2.jpg" prioritet="3" gen_id="16" desc="Image 2"/>
<Images image="5_0022_3.jpg" prioritet="4" gen_id="16" desc="Image 3"/>
</Images>
Now, the code above is only one item/product. But there are several proucts listed in the XML-file and I find it hard to get the product and the product info that I want to be displayed.
Here's my action script:
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("ToolData.xml"));
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
ParseBildata(xmlData);
}
function ParseTooldata(TooldataInput:XML):void {
trace("XML Output");
trace("------------------------");
trace(TooldataInput.Store);
}
If I want to trace the images I just write "trace(TooldataInput.Store.Images);
But if I want to trace one unik tool it's impossible. Well, maybe not impossible.. I just don't know how to do just that.
When you trace (TooldataInput.Store); you get all the tools at that store. But how do I trace only one tool using the unikID??
Thanks a lot in advance!