Formatando texto no flash sem complicação
labs novembro 8th, 2008Velhos tempos onde se formatar um texto dinâmico no flash era coisa do outro mundo, criava-se stylos, definia-se configurações manualmente, e muitas vezes era um sofrimento acertar a formatação ideal.
Pois bem, acabaram-se os problemas (pelo menos os meus), a classe caurina resolve pra gente, como? através da propriedade especial TextShortcuts.
Crie um campo de texto do tipo Dynamic text e defina o Instance name para texto_txt.
Após ter criado o campo de texto dinâmico, basta apenas inserir algum texto dentro da caixa, digitar o script abaixo e testar para comprovar.
// IMPORT CLASSES: Tweener, TextShortcuts import caurina.transitions.Tweener; import caurina.transitions.properties.TextShortcuts; // FUNCTION formatarTexto formatarTexto = function() { // INIT TextShortcuts TextShortcuts.init(); // DEFINE TEXT SIZE Tweener.addTween(texto_txt, {_text_size:25, time:0.5, transition:'linear'}); // DEFINE COLOR Tweener.addTween(texto_txt, {_text_color:0x003366, time:1, transition:'linear'}); // DEFINE INDENT Tweener.addTween(texto_txt, {_text_indent:100, time:1, transition:'linear'}); // DEFINE LEADING Tweener.addTween(texto_txt, {_text_leading:10, time:1, transition:'linear'}); // DEFINE MARGIN LEFT Tweener.addTween(texto_txt, {_text_leftMargin:20, time:1, transition:'linear'}); // DEFINE RIGHT MARGIN Tweener.addTween(texto_txt, {_text_rightMargin:20, time:1, transition:'linear'}); // DEFINE LETTERSPACING Tweener.addTween(texto_txt, {_text_letterSpacing:0.5, time:1, transition:'linear'}); } formatarTexto();
Veja aqui o exemplo em funcionamento.
Mamão com açúcar não? então, um viva para a classe caurina!
novembro 20th, 2008 at 1:03 pm
Nussa!!!
Sinceramente, não sinto a mínima falta dos velhos tempos de Action Script onde trabalhar com formatação de textos era pior do que programar em Assembler..huahua