I thought you said they were anonymous functions.  Post a test case.  I'm not 
sure what you want to do is possible.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of flexaustin
Sent: Friday, February 06, 2009 12:04 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Getting at variables inside a function that accepts a 
function


No as the functions are in separate classes and the var a, b, c, d are
private so in my class that calls the remote function I get Undefined
property a.

What about putting the vars in as params? Then I think there is a way
to access the params by order, correct?

So something like this to get at "a" in this example....

public function acceptingFunction (func1:Function=null,
func2:Function=null):void{
var a:Number;
var b:String;

if(func1 && func2){
if(func1(a=43))return true; <--- inserting local param
anotherAcceptFunction(func2);
}
}

Then do this...

acceptFunction(function():void{ whatever code is to get at params by
order params[0]?});

--- In flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>, Alex 
Harui <aha...@...> wrote:
>
> I assume just using a,b,c,d didn't work?
>
> Alex Harui
> Flex SDK Developer
> Adobe Systems Inc.<http://www.adobe.com/>
> Blog: http://blogs.adobe.com/aharui
>
> From: flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com> 
> [mailto:flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>]
On Behalf Of flexaustin
> Sent: Friday, February 06, 2009 8:55 AM
> To: flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>
> Subject: [flexcoders] Getting at variables inside a function that
accepts a function
>
>
> How would I go about getting at variables of a function when I send in
> an anonymous function so...
>
> public function acceptingFunction (func1:Function=null,
> func2:Function=null):void{
> var a:Number;
> var b:String;
>
> if(func1 && func2){
> func1;
> anotherAcceptFunction(func2);
> }
>
> }
>
> public function anotherAcceptFunction(func:Function=null){
> var c:Number;
> var d:String;
>
> if(func){
> func
> }
> }
>
> acceptFunction(function():void{get at vars a,b,c,d from here});
>
>
> I really don't want to extend the orig. function if I can help it, in
> this case extend the acceptingFunction, as its from some other library.
>

Reply via email to