The result from your cfc call isn't being cast correctly; it's nesting
the result inside an object.

public function result(event:Object) : void {
     MyModel.getInstance().adminARCHeadlines = new ArrayCollection
(event.result);
}


Either loop through the result object and addItem; one at a time.  Or
try changing the result format.

-TH

--- In flexcoders@yahoogroups.com, Greg Morphis <gmorp...@...> wrote:
>
> Still having a problem with this..
> I changed the assignment code to
> currVO = headlineVO(event.target.selectedItem);
> note: I also changed the name of the VO incase somewhere it was being
> set to null.
> Anyways I started the debugger and when I selected a row in the
debugger I see
> Type Coercion failed: cannot convert obj...@9bef331 to
> com.comp.MyApp.vo.headlineVO
>
> However when I explode [+]this and scroll down in the debugger
> this.currVO shows that it's a com.comp.MyApp.vo.headlineVO...
> WTH am I missing?
>
> On Fri, Mar 13, 2009 at 5:27 PM, ppongtong ppongt...@... wrote:
> > Please try
> > public function result(event:Object) :void
> > {
> >   var dummy :headlineVO; // add this line
> >
> >   MyModel.getInstance().adminARCHeadlines = new
ArrayCollection(event.result);
> > }
> >
> >
> > --- In flexcoders@yahoogroups.com, Greg Morphis gmorphis@ wrote:
> >>
> >> In the command result I have
> >> public function result(event:Object) : void {
> >> MyModel.getInstance().adminARCHeadlines = new ArrayCollection
(event.result);
> >> }
> >>
> >> adminARCHeadlines is an ArrayCollection in MyModel.as
> >>
> >> How do I tell it that it's an ArrayCollection of VOs?
> >>
> >> On Fri, Mar 13, 2009 at 3:21 PM, ppongtong ppongtong@ wrote:
> >> > Actually, when u get the data from cfc, did u map it to your
headlineVO?
> >> >
> >> >
> >> > --- In flexcoders@yahoogroups.com, Greg Morphis <gmorphis@>
wrote:
> >> >>
> >> >> I have a vo headlineVO that has the following variables
> >> >> headline_id:Number
> >> >> headline:String
> >> >> effdate:Date
> >> >> endeffdate:Date
> >> >> actionuser:String
> >> >> actiondate:Date
> >> >> I have a cfc that returns an ArrayCollection of beans, each bean
has
> >> >> the above variables too.
> >> >> I can populate a datagrid with this data and it shows fine.
> >> >> I'm trying to populate a new vo (currentVO) when the user
selects a
> >> >> row and hits "edit".
> >> >> The new VO shows as being null in the debugger.
> >> >> This is what my code looks like
> >> >>
> >> >> <mx:DataGrid id="headlinesDG"
> >> >> dataProvider="{MyModel.getInstance().adminARCHeadlines}"
> >> >> click="selectedHeadline" ...
> >> >> ...
> >> >> </mx:DataGrid>
> >> >>
> >> >> above I have a function
> >> >> private function selectedHeadline():void {
> >> >> currentVO = headlinesDG.selectedItem as headlineVO;
> >> >> }
> >> >>
> >> >> and for the editButton.click I have another function that just
Alert
> >> >> the currentVO.headline;
> >> >>
> >> >> I get a null object reference when I click on the edit Button.
> >> >> If I put a breakpoint above the Alert I can see that currentVO
is
> >> >> null, how can I assign that selected row to my vo?
> >> >> Can anyone offer suggestions or things I should check?
> >> >>
> >> >> Thanks in advance!
> >> >>
> >> >
> >> >
> >> >
> >> >
> >> > ------------------------------------
> >> >
> >> > --
> >> > Flexcoders Mailing List
> >> > FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> >> > Alternative FAQ location:
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-\
1e62079f6847
> >> > Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
Links
> >> >
> >> >
> >> >
> >> >
> >>
> >
> >
> >
> >
> > ------------------------------------
> >
> > --
> > Flexcoders Mailing List
> > FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Alternative FAQ location:
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-\
1e62079f6847
> > Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
Links
> >
> >
> >
> >
>


Reply via email to