# Puzzling! Code works on FLA but not in Class Package!

**URL:** https://forum.kirupa.com/t/puzzling-code-works-on-fla-but-not-in-class-package/315807
**Category:** flash
**Created:** [November 4, 2010, 4:43pm UTC](https://forum.kirupa.com/t/puzzling-code-works-on-fla-but-not-in-class-package/315807 "2010-11-04T16:43:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![yankleber](https://avatars.discourse-cdn.com/v4/letter/y/46a35a/32.png) [@yankleber](https://forum.kirupa.com/u/yankleber)
#### Post date: [November 4, 2010, 4:43pm UTC](https://forum.kirupa.com/t/puzzling-code-works-on-fla-but-not-in-class-package/315807/1 "2010-11-04T16:43:41Z")

</div>

Hi,

This is really puzzling me!  
I have this simple code in FLA:

```auto
var myclass:Class = getDefinitionByName("clsGirlWalking") as Class;
var mcPerson:MovieClip = new myclass();
addChild(mcPerson);

```

OK, so it DOES work, that is, the mc is instantiated in stage - great!

However, if I put the very same code in a class package:

```auto
package
{
    import flash.display.MovieClip;
    import flash.utils.getDefinitionByName;

    public class sgt extends MovieClip
    {
        public function sgt():void
        {
            var myclass:Class = getDefinitionByName("clsGirlWalking") as Class;
            var mcPerson:MovieClip = new myclass();
            addChild(mcPerson);
        }
    }
}

```

And call it from my FLA with:

```auto
import sgt;
var mysgt:sgt = new sgt();

```

Then it DOESN’T work!

PS: I can trace the new created mc in the output window, but it simply doesn’t show up in the stage!!!

What am I missing here?

Thanks!
