'event.result as Array' is returning null because event.result is 
not an Array. Is it an ArrayCollection or XML/XMLList perhaps?

--- In flexcoders@yahoogroups.com, "Greg Morphis" <[EMAIL PROTECTED]> 
wrote:
>
> I'm playing around with a remote object and in the handleResult
> function Flex is giving me this 1009 error when I try to refer to 
the
> variable I assigned to the event.result.
> If I do Alert.show(event.result[0].QUESTION.toString()); then I get
> the right result.
> However if I assign event.result to a variable, I get the error..
> myData = event.result as Array;
> Alert.show(myData.length.toString());
> bombs with the error
> TypeError: Error #1009: Cannot access a property or method of a 
null
> object reference.
> 
> Here's my code..
>             [Bindable]
>             public var myData:Array = new Array();
> 
>             public function handleResult( event : ResultEvent ) : 
void    {
>                 myData = event.result as Array;
>                 Alert.show(myData.length.toString());
>                 //Alert.show(event.result[0].QUESTION.toString());
>             }
> 
> So what's Flex whining about? myData is declared, it's assigned.. 
it
> should work?
> 
> Thanks!
>







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