Call JS with Flash... W/O A BUTTON

I need to call a bit of JS on the html page that contains my object, but i need it to be done automatically once a specific frame in the timeline is reached.
Here is the code I have in the body as an onLOAD, but it has issues when you refresh the page:

SwitchMenu('subX')

If i put it as a button the isses go away… but as i mentioned I need it to be activated in a frame from within the object to solve a smaill issue.
This is the HTML button code:

<a href="javascript:;" onclick="SwitchMenu('subX')">LINK TEXT</a>

I could really use some help on this one!
-Ron