# Attaching an object that extends MovieClip

**URL:** <https://forum.kirupa.com/t/attaching-an-object-that-extends-movieclip/185913>\
**Category:** Uncategorized\
**Created:** [April 17, 2006, 5:16pm UTC](https://forum.kirupa.com/t/attaching-an-object-that-extends-movieclip/185913 "2006-04-17T17:16:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dustin\_c1](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@dustin\_c1](https://forum.kirupa.com/u/dustin_c1)\
**Post date:** [April 17, 2006, 5:16pm UTC](https://forum.kirupa.com/t/attaching-an-object-that-extends-movieclip/185913/1 "2006-04-17T17:16:19Z")

</div>

In my code, I dynamically attach objects that extend MovieClip similar to the following code:  
myMovieClipObject.attachMovie(“ObjectA”, “ObjectB”+ i,200+i);  
ObjectA is an object in the library. Its linkage is to an AS 2.0 Class, we’ll call it myClass defined as follows:

class myClass extends MovieClip {  
var myProperty:String = “Some Value”;  
};

Later in my code, I can do all sorts of things to, say, ObjectB10, but the following is undefined:  
ObjectB10.myProperty;  
can anyone tell me why?

---

<div class="post-metadata">

**Author:** ![Ayman](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@Ayman](https://forum.kirupa.com/u/Ayman)\
**Post date:** [April 17, 2006, 10:00pm UTC](https://forum.kirupa.com/t/attaching-an-object-that-extends-movieclip/185913/2 "2006-04-17T22:00:13Z")

</div>

does it work with ObjectA ???

---

<div class="post-metadata">

**Author:** ![joran420](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joran420/32/2329_2.png) [@joran420](https://forum.kirupa.com/u/joran420)\
**Post date:** [April 18, 2006, 12:15am UTC](https://forum.kirupa.com/t/attaching-an-object-that-extends-movieclip/185913/3 "2006-04-18T00:15:52Z")

</div>

dont you need a constructor with classes?

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [April 18, 2006, 1:33am UTC](https://forum.kirupa.com/t/attaching-an-object-that-extends-movieclip/185913/4 "2006-04-18T01:33:01Z")

</div>

> [@joran420](#):
>
> dont you need a constructor with classes?

Flash will add in a constructor function for you if you don’t so there is no need to define one - unless of course you want some code to execute, pass parameters to the super and/or make it a private member to prevent instantiation through the use of the _new_ statement.

As for your problem, there is nothing wrong with what you have there - you should post your FLA 🙂
