If statement no-no?

Hi. Why is it that when I try to write
if (_root.enemy_y=_root.hero._y)
{shoot him;}

it puts the enemy wherever I put the hero? Is there a better way to do this, even if both objects are moving (the enemy randomly, the hero per whatever the user does)?

Sorry if this is a noob question. It’s my first post and I am grateful for all the help I’ve gotten just by lurking around in here.