You need to access the root / main timeline of your content.
Use the root property to access the root timeline of your content.
//function on main timeline
function foo():Void
{
trace("foo");
}
//called from anywhere in content
_root.foo();
//function on main timeline
function foo():void
{
trace("foo");
}
//called from anywhere in SWF
MovieClip(root).foo();
Note: In ActionScript 2 _root always refers to the main timeline of the main SWF. In ActionScript 3, the root property refers to the main timeline of the SWF in which the content originates. In most cases, these will be the same in either version of ActionScript. The main exception is where the property is being called from within a SWF that has been loaded into another SWF. In ActionScript 2 _root will refer to the main timeline of the main SWF (that loaded the other SWF). In ActionScript 3 the root property refers to the main timeline of the loaded SWF (and not the timeline of the SWF which loaded the other SWF).
The root property is only available in DisplayObject instances (such as MovieClip, Sprite, and Button).