Hi Patrick,

thx a bunch already for answering!!

Actually my example will already allow me to access the values like:
trace(  myResultObject[0].day );        // prints  'Mon'
trace(  myResultObject[0].[0].start );  // prints  '100'
...

But I guess there´s no way to use e.g. that 'start' value directly
via MXML binding, hm?
I should rather be using a custom renderer for it or flatten the  aray
on the client pre-binding?!

The latter(flatten array on client) just 'feels' a little uncomfortable,
as well as it feels not too good to change the data structure in the
backend 'only' for flex.

thx again & regards
carsten



--- In flexcoders@yahoogroups.com, [EMAIL PROTECTED] wrote:
>
> The way you constructed your array might come out like this, but not
> sure, looks a little crazy…
>
>
> myResultObject[0].day.mon.start.100.end.300
>
>
> Nested Arrays return into Flex as objects.  I haven't tried
nesting
> an array as complicated as this, I guess it's doable – but it
> might be better to reorganize your array structure .  I think it will
> be easier to read than a big old nested array constructor than in php
> if you use the following example, and this is how I do it.
>
>
> <?
> $my_array = array();
> $my_array[0]['days'] =$some array
> $my_array[0]['starts'] =$some_other_array
> Return $my_array;
> ?>
>
>
> //in flex your result arrays work like this...
>
> Var someArray:Array  = myResultObject[0].days
> Var someOtherArray:Array  = myResultObject[0].starts
>
>
> Then you can get your values and organize your arrays which ever way
> you like.
>
> Hope this Helps
>
> Patrick
> ________________________________________
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
> On Behalf Of carkraus
> Sent: Tuesday, December 05, 2006 11:19 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] AMFPHP / databinding nested arrays
>
> Hi there,
>
> I guess this is a typical newbie question,  maybe someone could
> kindly direct me to a tutorial or sample:
>
> I try to bind e.g. using a charts control to a nested array I receive
> from an AMFPHP service.
> On the php side I have as an example:
> $outputArr[] = array('day' => 'Mon', array('start' => '100', 'end' =>
> '300'));
> $outputArr[] = array('day' => 'Tue', array('start' => '250', 'end' =>
> '600'));
> $outputArr[] = array('day' => 'Wed', array('start' => '500', 'end' =>
> '600'));
> return $outputArr;
> ..which will deliver the data correctly as I can see from the flex
> debugger.
>
> In flex I have eg.:
> <mx:series>
>     <mx:ColumnSeries xField="day" yField="???" />
> </mx:series>
> Now, how do I access e.g. the value 'start' to use it for
> databinding? Well, 'day.start' does not do the trick : )
>
> I had similar probs using XML for binding, where I wouldnt be able to
> access sub-children?
> Do I have to somehow wrap the server response into an actionscript
> object which I'd have to manually add properties to?
>
> Any hint greatly appreciated!!
> carsten
>

Reply via email to