OK I don't mean to make this a bit convoluted - but I guess the basics of the
question is regarding using anonymous functions within a member class and being
able to set variables within that member class.
The convoluted question is this: I've got in my app an Interface class that
has pointers to scala/java functions and are passed in callbacks like so:
function echoOrderEvent(callback:Function):void ;
[UriParams(p1="correlationId")]
function echoOrderCacheEvent(callback:Function,extension:Object):void ;
Now in my class I create vars as functions for callbacks like so:
private var echoOrderCacheEvent:Function = function(jstr:String):void{
Alert.show("GOT ORDER EVENT ");
}
I set up the call back to this function as such:
interfaceClass.echoOrderCacheEvent(echoOrderCacheEvent, {correlationId:
sessionId});
Now, this works great except in the anonymous function I don't have any access
to the public or private member vars of the class - only of course if I make
the vars static, which is not what I want to do.
What I *can't* figure out is how to make the callback a regular member function
such as:
public function echoEvent(str:String):void{
blah blah
}
And have that work with the interface class -- as
interfaceClass.echoOrderCacheEvent(echoEvent, {correlationId: sessionId}) won't
work; what I was thinking was perhaps .call or .apply methods but not sure how
best to use them here...
Garry Schafer
grimmwerks
[email protected]
portfolio: www.grimmwerks.com/