Comparing variables inside functions to

Okay, here’s another one for you…

var q4:Boolean = false; //Will have thirty-eight of these, q4-q41

function noRepeat() {
if ([COLOR=red]q(_root._currentframe)[/COLOR] == true) {
gotoAndStop(randRange(4, 41));
} else if (([COLOR=#ff0000]q(_root._currentframe)[/COLOR]) == false) {
[COLOR=#ff0000]q(_root._currentframe)[/COLOR] = true;

Now, my problem is the bits in red (yes, I know they don’t work, that was just the best way I could think to describe what I wanted).

If I create a string that says “q4” then I find it won’t compare that to the boolean variable, but I’m positive there must be a better way than putting one of these on every frame.

I’d love some advice on this one. It’s hurting my head!