Buttons in AS3

Hello everybody,

I am sturggling to get to grips with AS3, I am not great at coding but just can’t get my head around the new way of linking buttons in AS3.

I want to create a button, that when it is clicked, it will load an external SWF.

Surely that can’t be to difficult.

This is the code that I have cobbled together, the trace me statement works but it doesnt load the SWF.

inv_btn.addEventListener(MouseEvent.MOUSE_DOWN, newvid);
function newvid(event:MouseEvent) {
trace(“you clicked me”);
var loadit = new Loader();
addChild(loadit);
loadit.load(new URLRequest(“PhysTest.swf”));
}

This is the error that comes up:

you clicked me
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at General::Input()
at Main()

Please help me, I am at my wits end!

Thanks

Stefano