This is a discussion on Flash CS3 e testi in html within the Articoli e tutorials forums, part of the Flash CS3 e Actionscript 3.0 category; Flash CS3 supporta alcuni tags html in modo da poter importare o scrivere dei testi in formato html.
Il Flash ...
Flash CS3 supporta alcuni tags html in modo da poter importare o scrivere dei testi in formato html.
Il Flash Player riconosce i tags utilizzando la proprietà htmlText della classe TextField.
Quindi ad esempio: nomeIstanzaCampoDiTesto.htmlText='Filippo';
Vediamo quali sono i tags supportati dal Flash Player 9 ...
Anchor Tag.
Il tag <a> e questi attributi: href, event, target
Bold tag <b>
Break tag <br>
Font tag <font> e questi atributi: color, face, size
Image tag <img> e questi attributi: scr, width, height, align, hspace, vspace, id, checkPolicyFile
Italic Tag <i>
List item Tag <li>
Paragraph tag <p> e questi attributi: align, class
Span tag <span> e questi attributi: class
TextFormat tag <textformat> e questi attributi: blockindent, indent, leading, leftmargin, rightmargin, tabstops
Underline tag <u>
Inoltre Flash CS3 supporta le seguenti entità html:
<, >, &, ", &apos
Ho creato un piccolo esempio di come utilizzare la proprietà htmlText della classe TextField:
Code:
package
{
import flash.display.MovieClip;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.events.TextEvent;
import flash.net.URLRequest;
import flash.net.navigateToURL;
public class TestiHtml extends MovieClip
{
public function TestiHtml()
{
createField();
}
private function createField():void
{
var tf:TextField=new TextField();
tf.x=20;
tf.y=50;
tf.autoSize=TextFieldAutoSize.LEFT;
tf.htmlText="Luna Rossa è nella finale della Luis Vuitton Cup, clicca Quì per vederla.";
addChild(tf);
tf.addEventListener(TextEvent.LINK,cliccato);
}
private function cliccato(t:TextEvent):void
{
var request:URLRequest=new URLRequest(t.text);
navigateToURL(request);
}
}
}