# Gettign mc instance passed through a string

**URL:** <https://forum.kirupa.com/t/gettign-mc-instance-passed-through-a-string/275937>\
**Category:** Uncategorized\
**Created:** [November 20, 2008, 12:08pm UTC](https://forum.kirupa.com/t/gettign-mc-instance-passed-through-a-string/275937 "2008-11-20T12:08:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Igro](https://avatars.discourse-cdn.com/v4/letter/i/71e660/32.png) [@Igro](https://forum.kirupa.com/u/Igro)\
**Post date:** [November 20, 2008, 12:08pm UTC](https://forum.kirupa.com/t/gettign-mc-instance-passed-through-a-string/275937/1 "2008-11-20T12:08:11Z")

</div>

Hi, this is my first post to this forum 🙂  
I’m trying to dynamically pass different movieclip names as strings to a function in order to tween them but im stuck with making flash understand that the mc names im passing are actual movieclips in the library.

```auto
        
public function receivedFromJavaScript(mc:String):void {
      var tMC:Class = getDefinitionByName(mc) as Class;
      var newMc:MovieClip = new tMC() as MovieClip;
      Tweener.addTween(newMc, {alpha:1, time:0.2, transition:"linear"});
}

```

So when I pass “MyMC” to the function abobve i recieve following error:  
“ReferenceError: Error #1065: Variable MyMC is not defined.”

Could anyone please point me in the right direction with this one?

/I
