Error 1009, the movieClip Exist but it's null when Traced
Hi ! Im new here, and i got a really irritating problem ,
I have a MovieClip called testCam in the 2nd frame on the stage, in testCam MovieClip i have Button, Movie Clip ect. i crating a seperated map about 27 frames, and each frame have a same MovieClip, so i made a function :
function addMovement():void{
addEventListener(Event.ENTER_FRAME, movement);
stage.addEventListener(KeyboardEvent.KEY_DOWN, pencet);
stage.addEventListener(KeyboardEvent.KEY_UP, angkat);
testCam.bag1.addEventListener(MouseEvent.CLICK, goToInventory);
}
and at each frame i just called addMovement to get a same function.
so i created all the frame, with the testCam, and called addMovement(); each frame, everything was normal, until i make a button inside the testCam Movie Clip.
I have a MC named Hoe, and a MC named Tool Box, i created button with Tool Box behind the Hoe, i think i'll be normal, because no Code on both MC, but all i get is, error1009:Error #1009: Cannot access a property or method of a null object reference.
When i use Ctrl+Shift+Enter, its point to this :
testCam.bag1.addEventListener(MouseEvent.CLICK, goToInventory);
I was check thousand times, and testCam is exist in stage, but after i put the new button there it's got error.
I try a simple experiment, i trace the testCam is null or not, and its strange, when i delete the new button there, its said testCam is exist, but after i put that new button its said testCam is null.
Please help me
, sorry for my bad english.
