How to make code from a string

i think u can do it via XML and the CustomFunctions methods in flash… but id rather do it all in flash if possible.

what i want to do is to treat a string as a line of code.

eg.

actV="trace('Red')"
 someButton.onPress=function(){
     actV.toCode()
 }

lol if only there was a toCode() method!!

can it be done? if so, how? :puzzled::q::-/

cheers,

Prophet.