Hello
I need help I'm trying to control the speed of the text
this is the code I used:
and this is the code I've been trying to put itCode:var effectTxt:String = _root.text1.text; _root.text1.text = ""; var startEff:Number = 1; _root.onEnterFrame = function (){ if (effectTxt.length>=startEff) { _root.text1.text = effectTxt.substr(0, startEff); startEff++; } else { clearInterval(writingInterval); delete _root; } };
From what I have been trying and experiment the code the "autoWrite" is the function name but from the first code I showed when I put a function name I get error saying "Function declaration is not permitted here" but I really need the first code because every time I used with the function name and when I go to another frame by clicking button the text in the next frame gets really fast and so on and so on but if I use the first code and I want to go to another frame by clicking button the text doesn't go fast and displayed in normal speed.Code:var writingInterval:Number = setInterval(autoWrite, 100);
the code with function name
I could do this frame by frame but it is going to take forever I have like a whole story to put inCode:var i:Number = 0; var myMessage:String = "One day... this is where I put the text"; function autoWrite():Void { if (i<=myMessage.length) { text1.text = myMessage.substr(0, i)+""; i = i+1; } else { clearInterval(writingInterval); delete _root; } } var writingInterval:Number = setInterval(autoWrite, 100);


Reply With Quote