Adding variables without button press

Hello,

I am trying to create a variable as soon as the playhead reaches a specific frame.

I tried:

onEnterFrame=var variablename:Boolean = new Boolean();
variablename=true;

but that did not work, of course.

How can I create a variable on a frame without the user having to press a button?

Also, I would like to know how to add a variable to the root movie from a movie that has been loaded externally.

Thank you very much.