View Full Version : [AS3] combobox help.. loading a for loop

10-03-2008, 05:33 PM
ok, I am trying to add a combobox that will add an array of ALL the xml items under the node <CompanyNameFormal>. So far, the xml loads, but it doesn't give me a combobox with multiple fields...it only gives me the first record...how would I make this give me every record?

Here is what I have so far:

import fl.controls.ComboBox;
import fl.data.DataProvider;

var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("_GB_Mining.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);

function processXML(e:Event):void {
myXML = new XML(e.target.data);

for (var i:uint = 0; i<myXML.length(); i++){

var CompanyNameFormal=myXML._GB_Mining[i].CompanyNameFormal[i];

var arr:Array = new Array();
arr.push({label: myXML._GB_Mining[i].CompanyNameFormal[i]});

var dp:DataProvider = new DataProvider(arr);

var cb:ComboBox = new ComboBox();
cb.dataProvider = dp;
cb.move(75, 75);
cb.setSize(200, 22);


Here is one record....this is repeated with different values...

<?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="_GB_Mining.xsd" generated="2008-10-01T09:06:44">
<CompanyNameFormal>African Eagle Resources plc</CompanyNameFormal>
<BoothName>African Eagle Resources plc</BoothName>
<MiningConcern>Developer, Explorer</MiningConcern>
<Chairman>John Gordon Park</Chairman>
<President_CEO>Mark Edwin Parker</President_CEO>
<Other_Countries_of_Operation>Mozambique, Tanzania</Other_Countries_of_Operation>
<Address>2nd Floor, 6-7 Queen Street, London, EC4N 1SP United Kingdom</Address>
<PhoneFax>+[44] 207-248-6059 / 207-691-7745</PhoneFax>
<Email>[email protected]</Email>
<Contacts>VP of Finance and/or CFO: Bevan John Metcalf | VP of Operations and/or COO: Christopher Davies</Contacts>
<Companyactivity>African Eagle is a UK-incorporated mineral exploration and development company operating in Zambia, Tanzania and Mozambique. These countries all have highly prospective geology, low above-ground risks and track records of successful major investments in the metals and minerals industries.The Company has a highly motivated team, proven management, an experienced board and has recently signed up industry partners with records of taking mines into production. The principal advanced projects, which are being fast-tracking towards production, are the Mkushi copper project in Zambia and the Miyabi gold project in Tanzania. The value of the JORC compliant resources on these properties underpins our valuation and share price.
African Eagle also holds a large well-balanced portfolio of promising earlier stage gold and base metal projects, including the Ndola copper project and the Eagle Eye iron-oxide copper gold project, both in Zambia.</Companyactivity>