# Class recasting movieclip as displayobject

**URL:** <https://forum.kirupa.com/t/class-recasting-movieclip-as-displayobject/285205>\
**Category:** Uncategorized\
**Created:** [March 28, 2009, 3:24pm UTC](https://forum.kirupa.com/t/class-recasting-movieclip-as-displayobject/285205 "2009-03-28T15:24:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gkatny](https://avatars.discourse-cdn.com/v4/letter/g/848f3c/32.png) [@gkatny](https://forum.kirupa.com/u/gkatny)\
**Post date:** [March 28, 2009, 3:24pm UTC](https://forum.kirupa.com/t/class-recasting-movieclip-as-displayobject/285205/1 "2009-03-28T15:24:51Z")

</div>

Hi All

I’ve tried googling for this situation and can’t find anything that addresses this specifically.

I have a class linked to a movieClip in a library. The MVC class (linked to the movieclip and entending the MovieClip class) instantiates the Model, View, and Control classes and passes them \_gallery = this as MovieClip.

In each of the subclasses the \_gallery is reassigned to \_currentGallery as MovieClip.

In the View Class, the function that builds the menu accepts the \_currentGallery as a MovieClip, but in a later function when I try \_currentGallery.getChlldByName(“page0”) it returns "1061: Call to a possibly undefined method getChildByName through a reference with static type flash.display:DisplayObject.

I can force it to behave by recasting as MovieClip, but I don’t understand why it’s recasting itself as a display object or how to prevent it.

Thanks in advance for any links, basic principles, formatting advice, or other helpful information you can give this lost newb
