Function problems


removeEnemies = new function()
{
    x = 0;
    while(x < _root.enemies.length)
    {
        unloadMovie(_root[_root.enemies[x]]);
        x++
    }
    
};


onClipEvent(enterFrame)
{
    if(_root.guy.hitTest(this))
    {
        
        removeEnemies();
        
        
        diditwork = true;
        
    }
}


I can’t seem to get this to work. What I want is if my character crosses a line, all the enemies are removed. The function is declared in a keyframe on the stage and the hitTest is in a line symbol. The actual function code works outside of the function, so it’s not that. “diditwork” is to test the hitTest.