PDA

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


caseyctg
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];
CompanyNameFormal_txt.text=CompanyNameFormal;

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;
addChild(cb);
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">
<_GB_Mining>
<ID>146</ID>
<CompanyNameFormal>African Eagle Resources plc</CompanyNameFormal>
<BoothName>African Eagle Resources plc</BoothName>
<PrimaryExchange_Symbol>LSE:AFE</PrimaryExchange_Symbol>
<MiningConcern>Developer, Explorer</MiningConcern>
<Chairman>John Gordon Park</Chairman>
<President_CEO>Mark Edwin Parker</President_CEO>
<Country_PIC_African>Zambia.ai</Country_PIC_African>
<PM_PIC_African>P-Copper.ai</PM_PIC_African>
<SM_PIC_African>S-Gold.ai</SM_PIC_African>
<CorporateLogo>na.jpg</CorporateLogo>
<Other_Countries_of_Operation>Mozambique, Tanzania</Other_Countries_of_Operation>
<Primary_Country_of_Operation>Zambia</Primary_Country_of_Operation>
<Latest_basic_market_capitalization>21MM</Latest_basic_market_capitalization>
<Latest_stock_price>0.10</Latest_stock_price>
<_x0035_2week_high>1.21<_x0035_2week_high>
<_x0035_2week_low>0.08<_x0035_2week_low>
<Shares_Outstanding>208MM</Shares_Outstanding>
<Warrants_Outstanding>20777500</Warrants_Outstanding>
<Options_Outstanding>300000</Options_Outstanding>
<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>
<Website>www.africaneagle.co.uk#http://www.africaneagle.co.uk#</Website>
<Contacts>VP of Finance and/or CFO: Bevan John Metcalf | VP of Operations and/or COO: Christopher Davies</Contacts>
<BoothNum>1256</BoothNum>
<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>
<_GB_Mining>