views:

36

answers:

1

It might sound confusing so let me explain the situation. I made a movieClip. And in that movieClip I have a dynamic textfield set. I called this textfield "AmmoCount"

I dragged this movieClip onto the stage several times and each time I called on the AmmoCount varible in each movieclip and gave it a different value. I get the following error

TypeError: Error #1009: Cannot access a property or method of a null object reference.

Below is my code

trace(game.score.wH.weapon1.AmmoCount.text);
trace(game.score.wH.weapon2.AmmoCount.text);

When I trace these objects, weapon1.AmmoCount works, but weapon2.AmmoCount shows as empty. Yet they both contain a value in them.

Ive used the weapon1 property and weapon2 property countless times and there is no doubt that it works. so why doesnt it work for weapon2. but for weapon1. Below is some code that I called on earlier that shows they work

game.score.wH.weapon1.alpha = 1;
game.score.wH.weapon2.alpha = .2;

these worked! but when I called on the AmmoCount text box within them, I get the error. The following image you can find within the weapon1 movieClip

alt text

+1  A: 

NEVERMIND,the reason it didnt work was because I created the textbox in the first frame but not in all the frames. each frame shows a different image. I change the frames but the textbox doesnt exist. had to create instance for each frame.

numerical25