I created a dymanic text field (already added to the stage) and made it html text. My problem is that I can't change some of the styles, such as p, span or b. I embeded the font and need to create a h1 tag, which I was trying to do with classes. Could someone please help me and tell me what I'm doing wrong. Here is my code;
myTF.htmlText = "";
myTF.htmlText += "<span class='headings'>Treaty with the Blackfeet Sioux, 1865.</span>";
myTF.htmlText += "<p>I have some text in here</p>";
myTF.htmlText += "<p>I have some more text in here</p>";
myTF.htmlText += "<p>I now have some text and a<a href='event:link'>link</a> to another frame in here</p>";
myTF.htmlText += "<p>I now have some text and a<a href='http://www.google.com'>link</a> to a website in here</p>";
myTF.addEventListener(TextEvent.LINK, myTFF);
function myTFF(e:TextEvent):void
{
gotoAndStop(e.text);
}
var myCSS:StyleSheet = new StyleSheet();
myCSS.setStyle("a:link", {color:'#0000CC',textDecoration:'none'}); <----Works
myCSS.setStyle("a:hover", {textDecoration:'underline'}); <----Works
myCSS.setStyle(".heading", {color:'#FFF'}); <-----Not working (with or without ".")
myTF.styleSheet = myCSS;
heading != headings.
fix one of those.
and assign the styles before using the styles:
var myCSS:StyleSheet = new StyleSheet();
myCSS.setStyle("a:link", {color:'#0000CC',textDecoration:'none'}); <----Works
myCSS.setStyle("a:hover", {textDecoration:'underline'}); <----Works
myCSS.setStyle(".heading", {color:'#FFF'}); <-----Not working (with or without ".")
myTF.styleSheet = myCSS;
myTF.htmlText = "";
myTF.htmlText += "<span class='heading'>Treaty with the Blackfeet Sioux, 1865.</span>";
myTF.htmlText += "<p>I have some text in here</p>";
myTF.htmlText += "<p>I have some more text in here</p>";
myTF.htmlText += "<p>I now have some text and a<a href='event:link'>link</a> to another frame in here</p>";
myTF.htmlText += "<p>I now have some text and a<a href='http://www.google.com'>link</a> to a website in here</p>";
myTF.addEventListener(TextEvent.LINK, myTFF);
function myTFF(e:TextEvent):void
{
gotoAndStop(e.text);
}
North America
Europe, Middle East and Africa
Asia Pacific