Enemy AI Help

Hello there guys, im new here. I have been playing around with flash for a few years now just for fun and have tried extensively to make games but when i cant figure something out i usually just abandon the project and quit. Well i want to follow through for once and i was wondering if you guys could help.

Ok, heres the dilemma. I am making a Helicopter Shooting Game type thing with Flash 5. The game works like this. You start on a small helipad and takeoff and start flying right across the screen. when you get about 1/3 across the screen the helicopter stops moving and the terrain below you (in this case grass) starts to scroll and the enemy helicopter movieclip flies in. It cant actually touch you but it stays about another 1/3 of the stage away and follows your movements up and down and a random selected speed. The problem is i cant get the clip to know when to fire at the player. I first thought it was my shootbullet function or my movebullet function or something. I then decided to scrap the whole shootbullet, etc. and start fresh. Thats when i learned after repeated tests that the computer didn;t know when to fire. The code i was using wasnt working. I want the computer to execute the contents of its if() statement when it is within 10 pixels either way of the players helicopter. I have tried everything i can think of but i cant get it to work. Any help would be greatly appreciated! Thanks guys!

-Doug