
20-05-08, 19:11
|
|
Junior Member
|
|
Join Date: May 2008
Posts: 2
Rep Power: 0
|
|
|
Trying to bring a .png to the stage through xml and a combo box
|
|
Hi!
I'm very new to AS and Flash, but my company wants me to develop an interactive slide that brings in data from a xml file and builds a combo box (cbClasses) and then populates a text area (taReq) in addition do calling an image to the stage.
So far, I've got the xml to work with the combo box and the text area, but I can't figure out how to call the image associated with the tag.
Here's what I've got so far:
Code:
//import controls
import flash.net.*;
import fl.controls.ComboBox;
//var declarations
var xmlData:XML;
var classDataLoader:URLLoader = new URLLoader();
var classreqDataLoader:URLLoader = new URLLoader();
//loading xml data
classDataLoader.load(new URLRequest("classes.xml"));
classDataLoader.addEventListener(Event.COMPLETE,loadCompleteClass);
//function extracting data from xml
function loadCompleteClass(event:Event):void
{
xmlData = new XML(classDataLoader.data);
for (var i in xmlData.crclass)
{
cbClasses.addItem({label:xmlData.crclass.name[i]});
}
}
//EventListeners for combo box
cbClasses.addEventListener(Event.CHANGE, showReq);
//function populating text area
function showReq(event:Event):void
{
var itemSelected:Number = cbClasses.selectedIndex;
taReq.text = xmlData..requirement[itemSelected];
}
HTML Code:
Class 5
Bouffant Caps, Hoods, Beard Cover, Face Mask, Coveralls, Gloves, Shoe Covers, Booties
file = "class5.png" width = "144" height = "415"
Class 6
Bouffant Caps, Hoods, Beard Cover, Face Mask, Coveralls, Gloves, Shoe Covers, Booties
file = "class6.png" width = "144" height = "415"
Class 7 (Cleanroom)
Bouffant Caps, Hoods, Beard Cover, Face Mask, Coveralls, Gloves, Shoe Covers, Booties
file = "class7cr.png" width = "144" height = "415"
Class 7 (Benches)
Bouffant Caps or Hoods, Beard Cover, Face Mask, Smock, Gloves
file = "class7bn.png" width = "144" height = "415"
Class 7 (Vestibules)
Bouffant Caps or Hoods, Beard Cover or Face Mask, Smock, Gloves
file = "class7vs.png" width = "144" height = "415"
Class 8
Bouffant Caps, Beard Cover, Smock
file = "class8.png" width = "144" height = "415"
Thank you in advance for any assistance! |
Last edited by Zane5100; 20-05-08 at 19:15..
Reason: To correct posting of code
|