Hello. This may be a stupid question but I hope I can get help with the structure of my code at least. I'm trying to syncronize an audio and some text by highlighting it.

In the main movie I have counter variable which calls charCounter3.as and timeVars variable which calls timeSettings.as I have onEnterFrame function that highlights the text while sound is playing. My code is:

Code:
function onEnterFrame(e:Event):void {
	pos=soundChannel.position;
	var minutes:uint=Math.floor(soundChannel.position/1000/60);
	var seconds:uint=Math.floor(soundChannel.position/1000)%60;
	debug_txt.text='position: '+pos;

	if (pos>=timeVars.setTimes(globalNum)) {
		if (pos<timeVars.setTimes(globalNum+1)) {

			txt.setTextFormat(def_tf, 0, txt.length);
			txt.setTextFormat(hl_tf, counter.breakPos[globalNum], counter.breakPos[globalNum+1]);
			globalNum=(timeVars.timeArr as Array).indexOf(Math.floor(pos));
		}
	}
}
Highlighted text needs to be updated on audio forwards and backwards. I think onEnterFrame isn't being able to catch the timeArr values. I will be glad if someone helps.