HI Philippe,

Yes that works - when I use any of the documented examples it's fine, but I'm not absolutely clear what the structure of the dataProvider is, because it's the result object from a remoting call.

All I know is that in a normal Flash MX movie I can use the object as a dataProvider for the comboBox component and I can access the selected item as selectedItem.label, but in Flex while I can use the result object as a dataProvider for the mx:ComboBox I can't access selectedItem.label

It seems like Flex handles data slightly differently and I can't quite get my head round it.

:-(


At 16:49 01/07/2005 +0200, you wrote:
I got it working fine the old school way
 
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Script>
<![CDATA[
var t = [{label:'item1',data:1},{label:'item2',data:2}];
]]>
</mx:Script>
<mx:ComboBox id="cb" dataProvider="{t}">
</mx:ComboBox>
<mx:TextInput text="{cb.selectedItem.data}"></mx:TextInput>
</mx:Application>

 
Philippe Maegerman
 

From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of pmarstonuoa
Sent: vendredi 1 juillet 2005 16:26
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Newbie can't find selectedItem in comboBox when dataProvider is remoteObject

Hi All,

Flex newbie here ;-)

As a way of checking out Flex I'm trying to port an ImageBank app
that was built using Flash MX, AMFPHP (Remoting) and mySQL

I've quickly got an interface up and running and I've managed to
populate a comboBox using the same remoting call that the original
comboBox uses.

In the original, selecting an item from the kingdom comboBox would
trigger another remoting call passing the selected item as an
argument.

The second call would result in the phylum comboBox being populated.

I can't get it to work in Flex.

I can populate the phylum comboBox if I pass an explicit argument,
but I just can't seem to find a way to access the 'selectedItem' from
the kingdom comboBox checking what I'm referencing I either get an
[object][object] or undefined!  :-(

I've tried various things like selectedItem.data, getSelectedItem()
etc etc

Has anyone else done this and got an insight?  I've read various bits
of documentation and searched this lists archive, but I seem to be
missing something?

Here's a summary version of my code - any insight would be very much
appreciated.

Cheers,

Phil

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
initialize="imagebank_ro.getCategories1.send();">
<mx:RemoteObject
endpoint="http://localhost/remoting/gateway.php"
id="imagebank_ro"
source="ImageBank"
protocol="http"
showBusyCursor="true">
<mx:method name="getCategories1" />
<mx:method name="getCategories2">
  <mx:arguments>
   <!-- this wont work -->
   <arg1>{kingdoms_cb.selectedItem.label}</arg1>
   <!-- but this does work -->
   <!-- <arg1>Plantae</arg1> -->
  </mx:arguments>
</mx:method>
</mx:RemoteObject>
...
<mx:ComboBox id="kingdoms_cb"
change="imagebank_ro.getCategories2.send();"
dataProvider="{imagebank_ro.getCategories1.result.items}" />
<mx:ComboBox id="phylums_cb"
dataProvider="{imagebank_ro.getCategories2.result.items}" />
...
</mx:Application>




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com


<?---- LSpots keywords ?><?---- HM ADS ?>

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com


<?---- LSpots keywords ?>

SPONSORED LINKS
Computer software testing Macromedia flex Development
Software developer


YAHOO! GROUPS LINKS



------------------------------------------------------------------
**STATEMENT OF CONFIDENTIALITY**

This e-mail and any attached files are confidential and intended solely for the use of the individual to whom it is addressed. If you have received this email in error please send it back to the person that sent it to you. Any views or opinions presented are solely those of author and do not necessarily represent those the Emakina Company. Unauthorized publication, use, dissemination, forwarding, printing or copying of this email and its associated attachments is strictly prohibited.

We also inform you that we have checked that this message does not contain any virus but we decline any responsability in case of any damage caused by an a non detected virus.
------------------------------------------------------------------

______________________________________________________________
Phil Marston
Learning Technologist
Learning Technology Unit
Edward Wright G33, University of Aberdeen, Aberdeen, AB24 3QY, UK
[EMAIL PROTECTED] Tel: +44(0)1224 273329 / +44(0)7798 723660
http://www.abdn.ac.uk/diss/ltu/
______________________________________________________________

University of Aberdeen Open Day - Tuesday 23rd August 2005
For more information visit our website http://www.abdn.ac.uk/openday or freephone 0800 027 1495
______________________________________________________________



--
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




Reply via email to