Simeon,

Very good description of the process and it makes perfect sense.  So 
it seems that one has to cast the generic to an array, which then is 
gets wrapped by the ArrayCollection.  

My curiosity about this process is that in Benoit's PhoneCairngorm 
app, in which an array of VO's are being passed back to the result, 
(exactly what I am doing), but in his app, no casting to Array is 
needed.  

This is the oddity and which I though could be a bug in the 
flexbuilder or somewhere in the flex chain.

Anyhow, lesson learned, when in doubt, in the future, I will 
definitely cast returned results.

Thanks again Simeon.

Tim



--- In flexcoders@yahoogroups.com, "Simeon Bateman" <[EMAIL PROTECTED]> 
wrote:
>
> Glad that was able to help you out :)
> 
> I dont know about a double cast per se, but I can tell you about 
why we
> needed this cast.  If you notice our handler gets a resultEvent 
object
> back.  We access the "result" property of that event.  If you look 
at the
> docs here:
> 
http://livedocs.macromedia.com/labs/1/flex/langref/mx/rpc/events/Resu
ltEvent.html
> You will see that the result property is typed as a generic 
object. This is
> done so we can return any data we need to from our remote 
services.  In our
> case though we are using that result in the constructor of our
> ArrayCollection.  The ArrayCollection can take an array as a 
constructor
> argument, but as far as flex knows event.result is just an 
object.  So we
> cast it to Array datatype to fullfil this requirement.
> 
> As for the other cast, without going back in the history of the 
thread, I
> can only guess.  My guess is that the items in the array need to 
implement a
> certain interface, and for the same reason as above ( result as a 
generic
> object) you needed to cast it to the correct type.
> 
> Hope that helps clear things up.  Glad you got thing running.
> 
> simeon
> 
> 
> On 4/18/06, sufibaba <[EMAIL PROTECTED]> wrote:
> >
> >
> > Simeon,
> >
> > You are a LEGEND... Been wacking my head on this.  That did the
> > trick.
> >
> > BTW, why is it that it one has to do a double cast.  In
> > PhoneCairngorm from Benoit, the compiler didn't need this extra
> > casting.  Is this some sort of bug do you think?
> >
> >
> > Tim
> >
> > --- In flexcoders@yahoogroups.com, "Simeon Bateman" <simbateman@>
> >
> > wrote:
> > >
> > > for the first part of your problem I think you need to cast the
> > results as
> > > an array
> > >
> > > change
> > > model.categoryList = new ArrayCollection(event.result);
> > > to
> > > model.categoryList = new ArrayCollection(event.result as 
Array);
> > >
> > > I have something similiar in my app and this is how I get 
around
> > the
> > > implicit type cast.
> > >
> > > simeon
> > >
> > >
> >
> >
> >
> >
> >
> >  --
> > 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
> >
> >
> >    -  Visit your 
group "flexcoders<http://groups.yahoo.com/group/flexcoders>"
> >    on the web.
> >
> >    -  To unsubscribe from this group, send an email to:
> >     [EMAIL PROTECTED]<flexcoders-
[EMAIL PROTECTED]>
> >
> >    -  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> >    Service <http://docs.yahoo.com/info/terms/>.
> >
> >
> >  ------------------------------
> >
>







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


Reply via email to