Hello
I am getting really annoyed with AS3, I know it is probably better for all you coders, but I cannot for the life of my find out how to load an external SWF through the clicking of a button in AS3.
import flash.net.URLRequest;
import flash.events.;
import flash.display.;
var PhysTestRequest:URLRequest = new URLRequest(“PhysTest.swf”);
var PhysTestLoader:Loader = new Loader();
inv_btn.addEventListener(MouseEvent.MOUSE_DOWN, newvid);
function newvid(event:MouseEvent):void
{
trace(“you clicked me”);
PhysTestLoader.load(PhysTestRequest);
addChild(PhysTestLoader);
}
That is the code that I have cobbled together and I am just getting this error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at General::Input()
at Main()
Why is this?
If anyone could help me, I would be eternally grateful.
Thanks
Stefan