Mic record on button click

I’m trying to get the mic to record when I press on a button (onClick). The mic can capture and playback if I put the code into

function Start()

Could anyone tell me what I’m doing wrong to make this work with an onClick button action?

#pragma strict

static var reco : AudioClip;

function onClick() {
    var aud = GetComponent.<AudioSource>();
    reco = Microphone.Start("Built-in Microphone", false, 2, 44100);
    aud.clip = reco;
    aud.Play()
}

Following up on my comment above, this is the solution to my follow-up question: How can I access other scripts and their functions? - Questions & Answers - Unity Discussions