# Method from passed Variable?

**URL:** <https://forum.kirupa.com/t/method-from-passed-variable/237516>\
**Category:** flash\
**Created:** [August 30, 2007, 11:10pm UTC](https://forum.kirupa.com/t/method-from-passed-variable/237516 "2007-08-30T23:10:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Psaldorn](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@Psaldorn](https://forum.kirupa.com/u/Psaldorn)\
**Post date:** [August 30, 2007, 11:10pm UTC](https://forum.kirupa.com/t/method-from-passed-variable/237516/1 "2007-08-30T23:10:33Z")

</div>

Hi all,

Having a little bother trying to call a method as defined elsewhere. I have a class Reactor that has public methods A and B and I want an intermediary call (Remoting) to turn the string of the method into well… actually calling it.

I have tried

```auto
React. **strMethod** (var1)

```

and

```auto
["React."+ **strMethod** +"(var1)"]

```

and

```auto
React.[**strMethod**](var1)

```

and some other variations on the square brackets, they do nothing mostly, a few variations throw errors.

I then moved to trying getDefinitionByName()

```auto

var *oRef *= getDefinitionByName( **strMethod** )
React.*oRef*(var1)

```

But these give “Variable TargetMethod not declared” etc.

So I also tried

```auto

var *oRef:Function *= getDefinitionByName( **strMethod** ) as Function
React.*oRef*(var1)

```

and also with ‘Class’ instead of Function.

Nothing seems to work ☹

To clarify, the call works if i just have it statically written, just not dynamically passed. Could anyone shine a ray of light onto this for me please? Eval seems so simple!
