# Access of possibly undefined property

**URL:** https://forum.kirupa.com/t/access-of-possibly-undefined-property/264703
**Category:** flash
**Created:** [June 29, 2008, 2:31am UTC](https://forum.kirupa.com/t/access-of-possibly-undefined-property/264703 "2008-06-29T02:31:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Exodar](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@Exodar](https://forum.kirupa.com/u/Exodar)
#### Post date: [June 29, 2008, 2:31am UTC](https://forum.kirupa.com/t/access-of-possibly-undefined-property/264703/1 "2008-06-29T02:31:17Z")

</div>

In the document class of my flash file, a variable is declared called “firstSound”. I’m trying to access this variable inside a movieclip sitting on the main timeline. However, I get an error when I try this:

trace(MovieClip(root).firstSound);

Error: 1119: Access of possibly undefined property firstSound through a reference with static type flash.display.DisplayObjectContainer.

Why am I getting this error?

---

<div class="post-metadata">

### Author: ![sekasi](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sekasi](https://forum.kirupa.com/u/sekasi)
#### Post date: [June 29, 2008, 3:14am UTC](https://forum.kirupa.com/t/access-of-possibly-undefined-property/264703/2 "2008-06-29T03:14:03Z")

</div>

You’re coding inside a movieclip on the stage? Or did I misunderstand you. : )

---

<div class="post-metadata">

### Author: ![Exodar](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@Exodar](https://forum.kirupa.com/u/Exodar)
#### Post date: [June 29, 2008, 6:54pm UTC](https://forum.kirupa.com/t/access-of-possibly-undefined-property/264703/3 "2008-06-29T18:54:38Z")

</div>

Yes, the script is located within the movieclip’s timeline, and the movieclip itself is on the stage.
