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
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to