Записки о Flash

ru.etcs.effects.TextTween

Версия 1.3.5 14.03.07.

Что нового в версии 1.3.5:

  • Исправлена работа removeEventListener. Если в одной области видимости подписано несколько обработчиков, то при удалении удалялся первый добавленный в этой области видимости, а не требуемый.

Что нового в версии 1.3:

  • Пофиксены некоторые баги
  • Статические свойства-имена событий, предпочтительно их использовать
  • Тексты с переводами строк, символами теперь твинятся нормально, без скачков
  • Добавлено свойство isPlaying
  • Подписка/отписка функций с заданной областью видимости

Использование:

This content requires Adobe Flash Player.

Поиграться можно прям здесь (72 КБ):

Javascript support required

Пожелания, баг-репорты и т.п. приветствуются.

Документация в теле класса.
Класс доступен во фреймворке.


30 comments

30 Comments so far

  1. Sneg November 2nd, 2006 18:08

    У тебя написано: «stop() — остановка твина, событие onTextStop не будет вызвано». А в событиях такого события нет, подразумевается onTextEnd ?

  2. __etc November 2nd, 2006 18:24

    Нет, onTextStop, просто ошибся в описании. Поправил.

  3. motor4ik November 3rd, 2006 12:39

    почему ты классы не выкладываешь в виде zip? или я не нахожу просто? а то неудобно копи&пастить ))

  4. __etc November 3rd, 2006 13:05

    Мммм, каждый упаковывать муторно.
    Хотя, наверное выложу как *.as файлы

  5. __etc November 5th, 2006 16:01

    Обошёлся без as файлов :)
    Теперь внизу есть ссылка «Загрузить класс» и view plain text source под ftf-ками.

  6. mix November 24th, 2006 16:08

    Так как человек я дикий, хотел бы знать…. мона ли этот класс исползывать в АS2 ???

  7. __etc November 24th, 2006 16:34

    А это и есть AS2 класс, собственно. AS3 версия здесь.
    Его нужно положить в папку ru/etcs/effects/ (папки надо создавать рядом с исходником) и назвать TextTween.as

  8. Sneg November 27th, 2006 16:46

    Интересно, а почему duration задается в кадрах? Может быть стоило задавать это параметр в милисекундах? Немного непривычно :)

  9. __etc November 27th, 2006 17:12

    Не имеет смысла, это потребует вычисления FPS и т.п. подобных вещей и в конечном итоге будет работать криво.

  10. hush January 31st, 2007 19:10

    if you write object oriented code, why don’t you give object oriented usage examples of it?
    How would a different class use your TextTween instance?
    For example, if my class that extends MovieClip has two TextField instances and i want to tween text in those fields, how should I implement TextTween for those fields to use it?

  11. __etc January 31st, 2007 19:26

    Oh, just fast method to check it, :)
    For two or more instances of TextField you can use this method (TextTween uses standard EventDispatcher class of Flash 8 ):

    import mx.utils.Delegate;
    import ru.etcs.effects.TextTween;
    ...any place of code..
    var anyTween:TextTween = new TextTween(...)
    var anotherTween:TextTween = new TextTween(...)
    anyTween.addEventListener('onTextChanged',Delegate.create(this,this.anyTextHandler);
    anotherTween.addEventListener('onTextChanged',Delegate.create(this,this.anotherTextHandler);
    ...
    private function anyTextHandler(event:Object):Void {
    trace('Text1: ' +event['text']);
    }
    private function anotherTextHandler(event:Object):Void {
    trace('Text2: '+event['text']);
    }
    ...

  12. hush February 3rd, 2007 13:25

    Hey, thanks very much!
    This was a torpedo fast answer ;]
    I shall test it as soon as i finish eating my breakfast ;]

  13. hush February 4th, 2007 01:26

    Ok, everything works fine ;]
    Thanks again!

  14. __etc February 4th, 2007 01:44

    Very good :)

  15. yvonia February 9th, 2007 06:08

    It’s brilliant thing!
    But I can’t use it :(
    Could you somebody send .fla file with example, please a lot?
    My e-mail: yvonia[at]o2.pl

    Best regards!
    Yvonia

  16. __etc February 9th, 2007 19:22

    Just create new folder, then create ru/etcs/effects/ folder and copy TextTween.as there.
    After that, create text field with instance name “my_txt” on the scene. Select first frame of scene and press F9 to open Actions panel and copy usage example code. That’s all :)
    BTW, i can create example fla, if it difficult to you.

  17. yvonia February 10th, 2007 14:01

    Thanks a lot! It works :) Regards!

  18. __etc February 20th, 2007 00:21

    hush, in new 1.3 version of TextTween you don’t need Delegate. Now, you can use it like this:

    import ru.etcs.effects.TextTween;
    ...any place of code..
    var anyTween:TextTween = new TextTween(...)
    var anotherTween:TextTween = new TextTween(...)
    anyTween.addEventListener(TextTween.CHANGED,this.anyTextHandler,this);
    anotherTween.addEventListener(TextTween.CHANGED,this.anotherTextHandler,this);
    ...
    private function anyTextHandler(event:Object):Void {
    trace('Text1: '+event['text']);
    }
    private function anotherTextHandler(event:Object):Void {
    trace('Text2: '+event['text']);
    }
    ...

  19. Nic May 1st, 2007 19:06

    Great work!!
    But if i want to reverse the text with a button when the text has been shown

  20. [...] класса TextTween на AS3. Код под катом. Собственно, сам класс: This content requires [...]

  21. [...] Собственно — TextTween. [...]

  22. TbI November 15th, 2007 19:11

    Привет _etcs. Пользую твой TextTween[AS3], не могу сделать Reverse – текстполе заполняется мусорными символами, они и уменьшаются по кол-ву, так и не превращаясь в оригинальный текст.. я что то не правильно понял?
    Спасибо.

  23. __etc November 15th, 2007 19:21

    Так реверс и работает в обратную сторону. Т.е. текст превращается из нормального в мусор, с уменьшением количества символов. А просто твин превращает из мусора в нормальный текст.

  24. TbI November 16th, 2007 12:21

    хм… у тебя в примере, включая реверс, текст остаётся нормальным у уменьшается…

  25. __etc November 16th, 2007 12:26

    Зависит ровным счетом от переданных параметров.

  26. TbI November 16th, 2007 12:30

    Да понял, isReverse = fasle; присваивал отдельно,
    Спасибо.

  27. __etc November 16th, 2007 12:48

    Пожалуй isReverse я зря публичным сделал.

  28. vi54 June 5th, 2008 22:35

    greetings, i have installed this class in my desktop/actionscript folder

    yet i get these errors(17 intotal). my txtfield is called my_txt. ia m absolutely sure my classpath is correct.

    what is wrong here please? thank you

    1046: Type was not found or was not a compile-time constant: Void.

    i get this error for 16 other lines , in other words for every function.

    what can i do?

  29. etc June 5th, 2008 22:40

    You need to set ActionScript 2.0 version in publish settings.
    ActionScript 3.0 version of TextTween is here.

  30. vi54 June 5th, 2008 23:00

    my mistake thank you, the russian text here confused me a bit :) you can remove my comment if needed.

Leave a reply