PDA

Просмотр полной версии : 100%динамический текст


bullshit
06.09.2006, 19:54
здравствуйте господа!
есть функция, которая вводит указанный тескт в динамическое поле по одной букве. есть похожая функция, которая этот текст по одной букве удаляет. КАК сделать такую функцию, которая одновременно определенный текст вводит, а тот тект который уже содержится удаляет, начиная с последего символа... скрипт в архиве... помогите или посоветуйте что-нибудь... заранее спасибо.

wvxvw
07.09.2006, 03:13
var myText:String = "My very long text";
var counter:Number = 0;
_root.onEnterFrame = function(){
_root.my_txt.text = _root.myText.substring(_root.counter, _root.counter+5);
if(_root.counter>=_root.myText.length){
_root.counter = 0;
} else {
_root.counter++;
}
}

bullshit
07.09.2006, 04:56
если честно, не понимаю как эта функция работает... если можешь прикрепи исходник с примером... спасибо

wvxvw
07.09.2006, 19:37
var myText:String = "Then hate me when thou wilt; if ever, now; ";
myText += "Now, while the world is bent my deeds to cross, ";
myText += "Join with the spite of fortune, make me bow, ";
myText += "And do not drop in for an after-loss: ";
myText += "Ah, do not, when my heart hath 'scoped this sorrow, ";
myText += "Come in the rearward of a conquer'd woe; ";
myText += "Give not a windy night a rainy morrow, ";
myText += "To linger out a purposed overthrow. ";
myText += "If thou wilt leave me, do not leave me last, ";
myText += "When other petty griefs have done their spite ";
myText += "But in the onset come; so shall I taste ";
myText += "At first the very worst of fortune's might, ";
myText += "And other strains of woe, which now seem woe, ";
myText += "Compared with loss of thee will not seem so. ";
var counter:Number = 0;
var myTF:TextField = _root.createTextField("tf_txt", 0, 0, Stage.height/2, Stage.width, 20);
myTF.background = true;
myTF.backgroundColor = 0xaaffcc;
myTF.border = true;
myTF.borderColor = 0x669978;
myTF.multiline = false;
var TF:TextFormat = new TextFormat();
TF.align = "center";
TF.bold = true;
TF.color = 0x447758;
myTF.setTextFormat(TF);
_root.onEnterFrame = function() {
_root.myTF.text = _root.myText.substring(_root.counter, _root.counter+20);
_root.myTF._width = Stage.width;
_root.myTF.setTextFormat(_root.TF);
if (_root.counter>=_root.myText.length) {
_root.counter = 0;
} else {
_root.counter++;
}
};

Открываем новый файл, копипастим, Cntrl+Enter

bullshit
08.09.2006, 02:23
спасибо за скрипт. идеал скрипта на http://www.group94.com , вот архив с fla-файлом...я скинул swf-архив в первый раз