# Using getchildat() as movieclip

**URL:** <https://forum.kirupa.com/t/using-getchildat-as-movieclip/299682>\
**Category:** Uncategorized\
**Created:** [November 9, 2009, 4:54pm UTC](https://forum.kirupa.com/t/using-getchildat-as-movieclip/299682 "2009-11-09T16:54:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![artheus](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@artheus](https://forum.kirupa.com/u/artheus)\
**Post date:** [November 9, 2009, 4:54pm UTC](https://forum.kirupa.com/t/using-getchildat-as-movieclip/299682/1 "2009-11-09T16:54:05Z")

</div>

Hey!

I’ve got a question that might make me look like a fool. But the question is:

Is it possible to somehow change a dynamic variable or call a dynamic function of an object using

```auto
container.getChildAt(index).variable = 234;
container.getChildAt(index).function();

```

I mean, if I write a class with some functions and variables that are public. And I need many instances of that class (which extends MovieClip, and is tied to a object in the library) inside the container object. and I want to run some functions and set some variables of the first object in the container object when the container.numChildren \> 10.

like this:

```auto

if (content.numChildren > 10) {
     content.getChildAt(0).function1();
     content.getChildAt(0).function2();

     content.getChildAt(0).variable1 = "yay!";
}

```

I get the error

```auto

1119: Access of possibly undefined property variable1 through a reference with static type flash.display:DisplayObject.

```

and equivalent.

Cheers,  
Artheus
