If you could post what finally works here. I'd like to see it. thanks brad
On Wed, Apr 8, 2009 at 12:05 PM, - - <sailorse...@yahoo.com> wrote: > Thanks Maciek that makes sense, I'll look into that. > > ------------------------------ > *From:* Maciek Sakrejda <msakre...@truviso.com> > *To:* flexcoders@yahoogroups.com > *Sent:* Wednesday, April 8, 2009 11:54:15 AM > *Subject:* Re: [flexcoders] Re: How can I have my class return an > ArrayCollection? > > So you want a function to return a result before it's there? I think you > can see the problem inherent in that design. > > In a runtime other than Flash, you could block if the user calls the > function before the result is available, but Flash won't let you do that > (and for good reason--the entire paradigm is built around nonblocking > actions). I think the only think you can do is have Services extend > EventDispatcher and dispatch an event when the result is returned, and > listen for that in the client. > > -Maciek > > -----Original Message----- > From: - - <sailorsea21@ yahoo.com <sailorsea21%40yahoo.com>> > Reply-to: flexcod...@yahoogro ups.com <flexcoders%40yahoogroups.com> > To: flexcod...@yahoogro ups.com <flexcoders%40yahoogroups.com> > Subject: Re: [flexcoders] Re: How can I have my class return an > ArrayCollection? > Date: Wed, 8 Apr 2009 08:35:32 -0700 (PDT) > > 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 <valdhorlists@ embarqmail. com<valdhorlists%40embarqmail.com> > > > To: flexcod...@yahoogro ups.com <flexcoders%40yahoogroups.com> > > 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( ); > > } > > } > > > > > >