Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 1.0/2.0 (http://www.flasher.ru/forum/forumdisplay.php?f=93)
-   -   Симпатичный текстовый эффект (http://www.flasher.ru/forum/showthread.php?t=134967)

SerKu 13.01.2010 07:33

Симпатичный текстовый эффект
 
Вложений: 2
В архиве лежит исходник с очень приятным текстовым эффектом.
Вложение 23615
Но текст только появляется. Что нужно добавить, чтобы текст появлялся, а через определенное время точно так же пропадал? (от первой буквы к последней)
Думаю данный эффект многим начинающим (типа меня) будет интересен:)

SerKu 13.01.2010 19:46

Что, никто так и не поможет?

Hauts 13.01.2010 20:14

Я помогу. Замените код:

Код AS1/AS2:

function fadeZoom(target:MovieClip, delay:Number):Void {
        target.interval = function() {
                target._visible = true;
                clearInterval(target.intervalID);
                target.onEnterFrame = function() {
                        target._xscale -= (target._xscale-100)/3;
                        target._yscale -= (target._yscale-100)/3;
                        target._alpha -= (target._alpha-100)/3;
                        if (Math.abs(target._xscale-100)<1) {
                                target._xscale = 100;
                                target._yscale = 100;
                                target._alpha = 100;
                                delete target.onEnterFrame;
                                target.fadeOutInterval = setInterval(fadeOut, 1000, target);
                        }
                };
        };
        target.intervalID = setInterval(target, "interval", delay);
        target._xscale = 2000;
        target._yscale = 2000;
        target._alpha = 0;
}
function fadeOut(target) {
        clearInterval(target.fadeOutInterval);
        target.onEnterFrame = function() {
                target._xscale -= (target._xscale)/3;
                target._yscale -= (target._yscale)/3;
                target._alpha -= (target._alpha)/3;
                if (target._xscale<2) {
                        target._xscale = 0;
                        target._yscale = 0;
                        target._alpha = 0;
                        delete target.onEnterFrame;
                }
        };
}
function placeText(target:MovieClip, x:Number, y:Number, banner:String, tFormat:TextFormat, effectFunction:Function, delay:Number):Void {
        // For each character...
        for (var i = 0; i<banner.length; i++) {
                // Create a clip and place the current
                // character in the text field inside it.
                var char:MovieClip = target.attachMovie("letter", "char"+i, target.getNextHighestDepth());
                char.field.text = banner.substr(i, 1);
                char._x = x;
                char._y = y;
                // Add the width of the current text character to the
                // next letter's x position.
                x += tFormat.getTextExtent(char.field.text).width;
                //
                // Here is the effect function call, passed in as a parameter
                effectFunction(char, i*delay);
        }
}
var format:TextFormat = new TextFormat();
format.font = "Arial";
format.size = 24;
placeText(this, 100, 200, "This is a text effect", format, fadeZoom, 100);


SerKu 13.01.2010 20:54

Спасибо огромное :-)


Часовой пояс GMT +4, время: 22:41.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.