Javascript won't work on layers I create


Hi. i am making a game and I am almost finished, but when I use this:

function update() {
if keyIsDown(‘p’) {
gotoAndPlay (105)// Do something here!
on a layer other than the default one, it dosen’t work. I don’t want to extend a frame as that would create # seconds of nothing in my game. Can anyone help?