Load and remove an external SWF.. i've a problem to remove it
I load an external swf in this way
PHP Code:
var termini_Loader:Loader = new Loader();
addChild(termini_Loader);
var termini_url:URLRequest=new URLRequest("termsnconditions.swf");
termini_Loader.load(termini_url);
addChild(termini_Loader)
termini_Loader.name="terms"
This external swf haves a close button that i want to use to kill itself. I want to put the code inside the external swf itself, not in the principal swf that loads it.. then i've wrote
PHP Code:
termini.closebtn.addEventListener(MouseEvent.CLICK, function()
{
(root as MovieClip).parent.removeChild(getChildByName("terms"))
})
but when i test it from the principal swf, this is the error
TypeError: Error #1009: Cannot access a property or method of a null object reference
What i've wrong?