instanceName as variable problem

I’m pretty new to AS, so I hope I can explain this properly. I have about 25 buttons that all should open different pdf’s. The pdf file names correspond to the instance names, so I figured I could setup one function and eventListener using instanceName.


stop();

function btnFunction(event: MouseEvent) {
    var countypdf:URLRequest = new URLRequest("file_location");
    navigateToURL(countypdf);
}

getChildByName("instanceName").addEventListener(MouseEvent.CLICK, btnFunction);

My main question is that I keep getting this message: Error #1009: Cannot access a property or method of a null object reference. And I don’t know how to fix it.

I’m also hoping someone might be able to tell me the proper way to use getChildByName(“instanceName”) inside of the “file_location” so that the URL would result in “instanceName”.pdf