# Referencing the stage from a loaded swf

**URL:** <https://forum.kirupa.com/t/referencing-the-stage-from-a-loaded-swf/249573>\
**Category:** flash\
**Created:** [January 20, 2008, 9:47am UTC](https://forum.kirupa.com/t/referencing-the-stage-from-a-loaded-swf/249573 "2008-01-20T09:47:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmattrw](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@mmattrw](https://forum.kirupa.com/u/mmattrw)\
**Post date:** [January 20, 2008, 9:47am UTC](https://forum.kirupa.com/t/referencing-the-stage-from-a-loaded-swf/249573/1 "2008-01-20T09:47:21Z")

</div>

I am converting my website, which has a liquid interface, to as3 but I am still learning and I have a problem.

I have child.swf that I load dynamically into parent.swf. When I run that I get:

> TypeError: Error #1009: Cannot access a property or method of a null object reference.  
> Through trial and error I found that the null object is the child.swf trying to reference the stage at several places such as stage.stageWidth. If I comment all of them out it runs error free, but it also doesn’t do anything. I have tried replacing the first ‘stage’ with other things such as ‘root.stageWidth’ but no dice.

I was also wonder how I can have a button in child.swf unload itself from the parent.swf?
