This does indeed work. Gonna try it further over the weekend. Thanks again!
J -----Original Message----- From: Mischa Williamson [mailto:[EMAIL PROTECTED] Sent: vrijdag 4 november 2005 12:59 To: Flashcoders mailing list Subject: Re: [Flashcoders] Autopopulating from a webservice You are right it is to do with the EventDispatcher. If i put this line into MM's addEventListener method: trace( "add event : " + this[queueName] ) The output is: add event : [type Function] When clearly it should be an array. I think it has something to do with the WSProxy class being dynamic. I haven't got time to debug it properly, but i have uploaded my EventDispatcher class: http://freeform-systems.com/share/actionscript/EventDispatcher.as Which definetely works with the WSProxy class and the code you posted. Hope this helps. cheers -- mischa On 11/4/05, Jeroen Janssen <[EMAIL PROTECTED]> wrote: > > Thanks for helping me out! > > I tried the code you posted but I still get the same result. > > It seems that onresult fires a resultHandler method and not the > listeningObject.result method. > > This is what I see if I uncomment your trace commands: > f : doCompanyInfo > Method doCompanyInfo was called with arguments: any,any,macr > Web service result : [object Object] > f : resultHandler > Method resultHandler was called with arguments: [object Object] > > Is it due to the eventdispatcher class you are using? > > Grtz, > Jeroen > > > -----Original Message----- > From: Mischa Williamson [mailto:[EMAIL PROTECTED] > Sent: vrijdag 4 november 2005 11:45 > To: Flashcoders mailing list > Subject: Re: [Flashcoders] Autopopulating from a webservice > > You need to access the "result" property of "eventObj". This works well > for > me: > > import com.ffsys.util.WSProxy; > > var listeningObj:Object = new Object(); > > listeningObj.result = function(eventObj:Object):Void { > trace("###"); > trace( "company : " + eventObj.result.company ); > > for( var z in eventObj.result ) > { > trace( z + " || " + eventObj.result[ z ] ) > } > } > > var ws:WSProxy = new WSProxy( " > http://www.flash-db.com/services/ws/companyInfo.wsdl" ); > > ws.addEventListener( "result", listeningObj ); > ws.doCompanyInfo("any","any","macr"); > > Hope it helps. > > cheers -- mischa > > On 11/3/05, Jeroen Janssen <[EMAIL PROTECTED]> wrote: > > > > Still not getting it :( > > > > I'm using this code with the class Mischa provided but it doesn't > work. > > Beware, this is my first time working with listeners so I could do > > something incredibly stupid ;) > > > > var listeningObj:Object = new Object(); > > > > listeningObj.result = function(eventObj:Object):Void { > > trace("###"); > > trace( eventObj.company ); > > } > > > > var ws:wsproxy = new wsproxy( > > "http://www.flash-db.com/services/ws/companyInfo.wsdl" ); > > > > ws.addEventListener( "result", listeningObj ); > > ws.doCompanyInfo("any","any","macr"); > > > > I already used different methods for the listeningobj but none of them > > seem to work. > > > > Please help :) > > > > Jeroen > > > > > > > > -----Original Message----- > > From: NEILHIGHLEY.COM <http://NEILHIGHLEY.COM> <http://NEILHIGHLEY.COM> > [mailto: > > [EMAIL PROTECTED] > > Sent: woensdag 2 november 2005 19:59 > > To: Flashcoders mailing list > > Subject: Re: [Flashcoders] Autopopulating from a webservice > > > > Well, with a little bit of guidance from Mischa I have this sorted. > > > > I had to use an event proxy which was visible from the root, to > > courier the event from the webservice class I created back to the > > consuming class, as the addEventListener was not returning to the > > class if the listener was added to the webservice class...phew.. > > > > e.g. > > The following worked (note: this is a selection of code) > > // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > - - - - - - - - - - - - - - - > > (in standard class) > > public function getCategorys(){ > > _root.eventProxy.addEventListener( "categoriesLoaded", > > populateCategorys ); > > webservice.getCategorys(); > > } > > > > (in webservice class) > > function getCategorys():Void{ > > wsCall=webService.getCategories(wsPassword); > > wsCall.onResult=function(result):Void{ > > trace("webservice returned"); > > > > _root.eventProxy.triggerEvent("categoriesLoaded",result); > > } > > } > > > > (eventProxy class) > > import mx.events.EventDispatcher; > > class event_sender{ > > //broadcaster > > private var controller:Object; > > public var dispatchEvent:Function; > > public var addEventListener:Function; > > public var removeEventListener:Function; > > function event_sender(){ > > EventDispatcher.initialize( this ); > > } > > > > function triggerEvent(sEvent:String,oValue:Object){ > > trace("proxy triggered"); > > var eventObject:Object = {target:this, > > type:sEvent,result:oValue}; > > dispatchEvent(eventObject); > > } > > } > > > > (and in root..) > > var eventProxy:event_sender=new event_sender(); > > > > // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > - - - - - - - - - - - - - - - > > > > It seems to me that actionscript still loses references to remote > > objects within its code and without referring to a global you cannot > > link two objects via events. > > > > If you can suggest an easier way of doing this, or point out that Im a > > noob and show me a proper way, Im all ears. > > > > Neil > > > > > > -- > > www.neilhighley.com <http://www.neilhighley.com> < > http://www.neilhighley.com> > > _______________________________________________ > > Flashcoders mailing list > > [email protected] > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > > _______________________________________________ > > Flashcoders mailing list > > [email protected] > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > _______________________________________________ > Flashcoders mailing list > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > _______________________________________________ > Flashcoders mailing list > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

