Function()

Hi
I have this code on the first frame, on a layer dedicated for actionscripts:*

 frame = _root.mainLinkArea._currentFrame;

function linkArea(needed){
if(needed && frame != 12){
**_root.mainLinkArea.gotoAndPlay(“out”)
**}

     **if(!needed && frame == 12){
          **_root.mainLinkArea.gotoAndPlay("in")    
         **}
 }
 
 *I want to access the function* linkArea* from a button; when the button is pressed it's going to send either *true* or *false* to *linkArea* function, and execute it. How do I achive this?
 
 /henrik, sweden