If you are having problems with it giving you a null object before the 
ResultEvent function is called then make a function that returns an empty 
ArrayCollection if it is currently null.

Perhaps

function getServiceArray( ):ArrayCollection
{
    if( this.serviceArray == null )
    {
        this.serviceArray = new ArrayCollection();
    }
    return this.serviceArray();
}

If that isn't what you are having problems with, perhaps more specificity could 
help us help you.

--- In [email protected], - - <sailorse...@...> wrote:
>
> I tried that but it returns an empty ArrayCollection because it's only 
> created within the ResultEvent Function once the HTTPService is successful...
> 
> Thanks.
> 
> 
> 
> 
> ________________________________
> From: valdhor <valdhorli...@...>
> To: [email protected]
> Sent: Wednesday, April 8, 2009 11:20:44 AM
> Subject: [flexcoders] Re: How can I have my class return an ArrayCollection?
> 
> 
> Umm.. Add a public function that returns serviceArray ?
> 
> --- In flexcod...@yahoogro ups.com, "sailorsea21" <sailorsea21@ ...> wrote:
> >
> > Hi everyone, 
> > how can I have this following class return me an ArrayCollection whenever I 
> > call it????
> > 
> > [Bindable] 
> > public class Services
> > {
> > public var serviceArray: ArrayCollection;
> > public var serviceXML:XML;
> > 
> > public function getServices( ):void
> > {
> > var service:HTTPService = new HTTPService( );
> > service.url = "test.php";
> > service.useProxy = false;
> > service.method = "POST";
> > service.resultForma t = "e4x";
> > service.showBusyCur sor = true;
> > service.addEventLis tener(ResultEven t.RESULT, 
> > function (event:ResultEvent) :void
> > {
> > serviceArray = new ArrayCollection( );
> > serviceXML = event.result as XML;
> > var ourxml:XML;
> > for each(ourxml in serviceXML.elements ()) serviceArray. addItem(ourxml) ; 
> > }
> > ); 
> > service.send( ); 
> > }
> > }
> >
>


Reply via email to