Hello,
I’m not sure if this is possible but I’m trying to fiqure out a way to have multiple SetInterval functions. what I’m trying to do is have text highlight a sentence using the setinterval function than after the number of chars needed are highlighted I want to be able to clear the interval and then start with the next sentence through another setInterval.
The program I’m trying to write is somewhat of a text to speech. I have a audio clip and a static text box. the audio is supposed to sync with the highlight of the text. the only way i could fiqure to generate the sync with a highlight was through setSelection as a loop.
I hope i’m making sense as this is my first post and I’m new to this type of actionscript.
here is where I am currently at.
var i:Number = 0;
var my_snap:TextSnapshot = test.getTextSnapshot();
var count:Number = my_snap.getCount()
my_snap.setSelectColor(0xffff00);
var intervalId:Number;
var count:Number = 0;
var count2:Number = 0;
var maxCount:Number = 20;
var maxCount2:Number = 113;
var duration:Number = 50;
var intervalId:Number;
var count:Number = 0;
var maxCount:Number = 20;
var duration:Number = 50;
function executeCallback():Void {
trace("executeCallback intervalId: " + intervalId + " count: " + count);
my_snap.setSelected(i, i+1 , true)
i++;
if(count >= maxCount) {
clearInterval(intervalId);
my_snap.setSelected(0, 21 , false);
clearInterval(intervalId);
}
count++;
}
function beginInterval():Void {
if(intervalId != null) {
trace("clearInterval");
clearInterval(intervalId);
}
intervalId = setInterval(this, "executeCallback", duration);
}
function beginInterval2():Void {
if(intervalId != null) {
trace("clearInterval");
clearInterval(intervalId);
}
intervalId = setInterval(this, "executeCallback", duration);
}
beginInterval();
beginInterval();
help
floyd