How do i declare variables et c only ONCE in function?

Hi. I have a problem with functions and variables… i need a kind of help with how to get functions that i use every onEnterFrame.
et c:
A MC is using this:
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#0000ff]onClipEvent[/COLOR] COLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]_root[/COLOR].[COLOR=#000080]randomWalk[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR]
[/LEFT]
[/FONT]

and this is the functions it calls:
ActionScript Code:
[FONT=Courier New][LEFT]randomWalk = [COLOR=#000000]function[/COLOR] COLOR=#000000[/COLOR]
[COLOR=#000000]{[/COLOR]
tXH = [COLOR=#0000ff]target[/COLOR].[COLOR=#0000ff]_x[/COLOR] + [COLOR=#000080]15[/COLOR];
tXL = [COLOR=#0000ff]target[/COLOR].[COLOR=#0000ff]_x[/COLOR] - [COLOR=#000080]15[/COLOR];
tYH = [COLOR=#0000ff]target[/COLOR].[COLOR=#0000ff]_y[/COLOR] + [COLOR=#000080]15[/COLOR];
tYL = [COLOR=#0000ff]target[/COLOR].[COLOR=#0000ff]_y[/COLOR] - [COLOR=#000080]15[/COLOR];
rwX = [COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]round[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]random[/COLOR] COLOR=#000000[/COLOR] * [COLOR=#000000]([/COLOR]tXH - tXL[COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR] + tXL;
rwY = [COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]round[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]random[/COLOR] COLOR=#000000[/COLOR] * [COLOR=#000000]([/COLOR]tYH - tYL[COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR] + tYL;
[COLOR=#0000ff]target[/COLOR].[COLOR=#0000ff]_x[/COLOR] += [COLOR=#000000]([/COLOR][COLOR=#0000ff]target[/COLOR].[COLOR=#0000ff]_x[/COLOR] - rwX[COLOR=#000000])[/COLOR] / [COLOR=#000080]100[/COLOR];
[COLOR=#0000ff]target[/COLOR].[COLOR=#0000ff]_y[/COLOR] += [COLOR=#000000]([/COLOR][COLOR=#0000ff]target[/COLOR].[COLOR=#0000ff]_y[/COLOR] - rwY[COLOR=#000000])[/COLOR] / [COLOR=#000080]100[/COLOR];
[COLOR=#000000]}[/COLOR];
[/LEFT]
[/FONT]

As you can see it gets new variables onEnterFrame… How do i get around this?