[flexcoders] flex2: context out of Function

2006-07-21 Thread Roman Protsiuk
Hi, everyone.

Is it possible in Flex 2 to get context for some method described by
Function object?
I need to call another method out of that context (another method of
that object).

public class TestClassThatCalls extends TestClass {

   private var _context : someClass;

   public function someFunction(method : Function) {

   //
   // put into _context object that this method belongs to
   //

   _context.doSmth();
   }
}

public class TestClassContainsCalled extends TestClass {

   var _counter : int;

public function addIt() : TestClassThatCalls {
var c : TestClassThatCalls = new TestClassThatCalls();

c.someFunction( funcThatWePass );

return c;
}


   public function funcThatWePass(): void {
   }

   public function doSmth() : void {
   _counter++;
   }

}


later we do:
var a : TestClassContainsCalled = new TestClassContainsCalled();
var b : TestClassThatCalls = a.addIt();

after this _counter value have to be increased by 1.

Thanks,
Roma.


 Yahoo! Groups Sponsor ~--> 
Yahoo! Groups gets a make over. See the new email design.
http://us.click.yahoo.com/XISQkA/lOaOAA/yQLSAA/nhFolB/TM
~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





[flexcoders] flex2: context out of Function

2006-07-21 Thread Roman Protsiuk
Hi, everyone.

Is it possible in Flex 2 to get context for some method described by
Function object?
I need to call another method out of that context (another method of
that object).

public class TestClassThatCalls extends TestClass {

private var _context : someClass;

public function someFunction(method : Function) {

//
// put into _context object that this method belongs to
//

_context.doSmth();
}
}

public class TestClassContainsCalled extends TestClass {

var _counter : int;

public function funcThatWePass(): void {
}

public function doSmth() : void {
_counter++;
}

}


later we do:
TestClassThatCalls.someFunction( TestClassContainsCalled.funcThatWePass );

after this _counter value have to be increased by 1.

Thanks,
Roma.


 Yahoo! Groups Sponsor ~--> 
Something is new at Yahoo! Groups.  Check out the enhanced email design.
http://us.click.yahoo.com/SISQkA/gOaOAA/yQLSAA/nhFolB/TM
~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/