If you don't know what is in an object, use a for-in loop to trace() the
names and values of its properties:
var p:String;
for (p in o)
{
trace(p + ": " + o[p]);
}
- Gordon
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Phil Marston
Sent: Friday, July 01, 2005 9:05 AM
To: [email protected]
Subject: RE: [flexcoders] Newbie can't find selectedItem in comboBox
when dataProvider is remoteObject
Hi Tracy,
What you've described is exactly where I've been looking.
To be honest I'm not sure what the dataProvider looks like or what it is
beyond being an 'object' - in the Flash MX IDE I could look at what was
getting passed back and forth in the remoting debugger, but I'm not sure
how to do that in Flex
What I do know is that accessing remoteObject.call.result.items as the
dataProvider appears to populate the label fields of the ComboBox (Looks
like a populated comboBox as intended), but there does not appear to be
a
selectedItem.label nor a selectedItem.data available on selection
(though
selectedItem itself is an [object Object] - how do I get to see what
that
object and it's properties are?
How can I post you a bit of the dataProvider?
Cheers,
Phil
At 11:50 01/07/2005 -0400, you wrote:
>The [Object] object thing means you are trying to look at a complex
>object, which selectedItem returns. SelectedItem is not a value, as
you
>might expect, but rather a reference to the row/node/object in the
>dataProvider that populated that particular list item. What you
probably
>want is a property of that object.
>
>What does your dataProvider look like? If you have used the default
>array of objects, with "label" and "data" properties, and then your
>selectedItem.data should work. Are you using a result handler and can
>you debug the result of the remote object?
>
>Since selectedItem is an Object, you might need to cast it to the type
>that your dataProvider really provides.
>
>Now, Combobox has a property value, about which the docs say:
>value
>value: Object
>
>The data property if it exists or the label property of the
>selectedItem.
>
>Note again that it is an object, and your should cast it to a string or
>number or whatever.
>
>Post a bit of your dataProvider content if you are still having
trouble.
>
>Tracy
>
>-----Original Message-----
>From: [email protected] [mailto:[EMAIL PROTECTED] On
>Behalf Of pmarstonuoa
>Sent: Friday, July 01, 2005 10:26 AM
>To: [email protected]
>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
Yahoo! Groups Links
--
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
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/