You could loop thru the dataprovider of
your combo and compare to whatever your current value for that field is…then
set the combos selected index.
HTH,
Stace
(not tested)
var iniVal:Object;
function resultHandler(result){
iniVal = result;
var dp = comboboxId.dataProvider;
for(var i:Number=0; i < dp.length; i++){
if( dp[i].data == remoteCallResultValueHere ){
comboboxId.selectedIndex = i;
break;
}
}
}
From:
[email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Ghislain Simard
Sent: Sunday, July 17, 2005 3:41
PM
To: [email protected]
Subject: [flexcoders] get ComboBox
selected item with RemoteObject
Hi,
How can we get an item selected in a ComboxBox
when it's coming from
a RemoteObject?
my code:
<?xml version="1.0"
encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:RemoteObject id="toitureObject"
source="EEwizard3.G.toit_nf">
<mx:method name="affichage"
result="resultHandler(event.result)">
<mx:arguments>
<zoneID>1</zoneID>
</mx:arguments>
</mx:method>
</mx:RemoteObject>
<mx:Script>
<![CDATA[
var iniVal:Object;
function resultHandler(result){
iniVal = result;
}
]]>
</mx:Script>
<mx:Model id="typeToitureModel">
<toiture>
<type>
<label>Type
I</label>
<data>3300</data>
</type>
<type>
<label>Type
II</label>
<data>3301</data>
</type>
<type>
<label>Type
III</label>
<data>3302</data>
</type>
</toiture>
</mx:Model>
<mx:Button label="Get Data"
click="getdata();"/>
<mx:ComboBox
dataProvider="{typeToitureModel.toiture.type}"
value="3302"
selectedItem="{???????????}"/>
</mx:Application>
Thanks
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS