# Buttons in AS3

**URL:** <https://forum.kirupa.com/t/buttons-in-as3/257395>\
**Category:** flash\
**Created:** [April 13, 2008, 9:02pm UTC](https://forum.kirupa.com/t/buttons-in-as3/257395 "2008-04-13T21:02:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefanmhodgson](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@stefanmhodgson](https://forum.kirupa.com/u/stefanmhodgson)\
**Post date:** [April 13, 2008, 9:02pm UTC](https://forum.kirupa.com/t/buttons-in-as3/257395/1 "2008-04-13T21:02:38Z")

</div>

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
