Calling a func to a dyn txt field

this code works when I have an onClipEvent on the text field.

function navc(fontColor){
 navColor=new Color(fontColor);

this one doesn’t work when placed on a dyn txt field

function navs(fontSize){
 navSize=new TextFormat();

thay have this in the Macro Fl MX AS book but it’s not working
how do i set up that function and call it on the main AS page instead of placing it on the MC itself?