# How to get the class instance of a method

**URL:** <https://forum.kirupa.com/t/how-to-get-the-class-instance-of-a-method/255342>\
**Category:** Uncategorized\
**Created:** [March 21, 2008, 12:39pm UTC](https://forum.kirupa.com/t/how-to-get-the-class-instance-of-a-method/255342 "2008-03-21T12:39:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fragilem17](https://avatars.discourse-cdn.com/v4/letter/f/ecccb3/32.png) [@Fragilem17](https://forum.kirupa.com/u/Fragilem17)\
**Post date:** [March 21, 2008, 12:39pm UTC](https://forum.kirupa.com/t/how-to-get-the-class-instance-of-a-method/255342/1 "2008-03-21T12:39:02Z")

</div>

Hi guys,

My first post on kirupa.

Is there a way to get the class instance  
(meaning “aMenuInstance” inside SomeClass) from the passed method “load”  
\_scope inside Task should be the “aMenuInstance” from SomeClass.

```auto

 public class Task extends EventDispatcher
 {
  private var _scope:Object;
  private var _method:Function;
  private var _evt:String;
 
  public function Task(method:Function, evt:String = "") 
  {
[COLOR=seagreen] // _scope would need to be _aMenuInstance[/COLOR]
   [COLOR=red]_scope = method.some_magical_undocumented_function_or_something;[/COLOR]
   _method = method;
   _evt = evt;
  }
  .....
 }

```

```auto

 public class SomeClass
 {
   private var _aMenuInstance:SomeMenuClass;
 
   public function SomeClass ()
   {
    _aMenuInstance = new SomeMenuClass();
    var aTask:Task = new Task(_aMenuInstance.load, "menuLoaded");
   }
 }

```

any ideas?
