title: Remove instance of object IF it exists on stage
body: <p>I'm trying to check if there is an instance of an object on screen, and IF there is - remove it. The code is as follows -</p>
  
  <pre><code>if (gracetarget.parent)
  {
   gracetarget.removeEventListener(Event.ENTER_FRAME, gracetarget.graceListener);
   gracetarget.parent.removeChild(gracetarget);
  }
  else if (springtarget.parent)
  {
   springtarget.removeEventListener(Event.ENTER_FRAME, springtarget.springListener);
   springtarget.parent.removeChild(springtarget);
  }
  </code></pre>
  
  <p>I get the following error -
  TypeError: Error #1009: Cannot access a property or method of a null object reference.</p>
  
  <p>I guess it's because I'm trying to remove an object that doesn't exist, but surely the IF statement should only run if the object exists?</p>