# MovieClip(parent).addEventListener isn't allowed?

**URL:** <https://forum.kirupa.com/t/movieclip-parent-addeventlistener-isnt-allowed/269198>\
**Category:** flash\
**Created:** [August 24, 2008, 1:19pm UTC](https://forum.kirupa.com/t/movieclip-parent-addeventlistener-isnt-allowed/269198 "2008-08-24T13:19:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DesignerMichael](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@DesignerMichael](https://forum.kirupa.com/u/DesignerMichael)\
**Post date:** [August 24, 2008, 1:19pm UTC](https://forum.kirupa.com/t/movieclip-parent-addeventlistener-isnt-allowed/269198/1 "2008-08-24T13:19:01Z")

</div>

I am trying to add an event listener to a parent object from a child object, is this not possible???

```auto

MovieClip(parent).smartFox.addEventListener(SFSEvent.onConnection,onConnection);

```

That works fine when placed on the parent object…

```auto

smartFox.addEventListener(SFSEvent.onConnection,onConnection);

```

Not sure what to do here… I even tried the uza.utils\* global class.

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [August 24, 2008, 1:27pm UTC](https://forum.kirupa.com/t/movieclip-parent-addeventlistener-isnt-allowed/269198/2 "2008-08-24T13:27:47Z")

</div>

maybe parent isn’t valid yet? Whats the error

---

<div class="post-metadata">

**Author:** ![DesignerMichael](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@DesignerMichael](https://forum.kirupa.com/u/DesignerMichael)\
**Post date:** [August 24, 2008, 1:39pm UTC](https://forum.kirupa.com/t/movieclip-parent-addeventlistener-isnt-allowed/269198/3 "2008-08-24T13:39:35Z")

</div>

The standard null object refrence.

TypeError: Error #1009: Cannot access a property or method of a null object reference.  
at battleTanksGame$iinit()  
at battleTanks/::onJoinRoom()

I got around it now anyway… The reason my global wasn’t working becaust it was placed before the initialization of the client.

```
        smartFox=new SmartFoxClient(true);
        global.smartFox = smartFox;

```

This works…  
global.smartFox.addEventListener(SFSEvent.onUserVariablesUpdate, onUserVariablesUpdate);
