• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

CSS tags

Guest
Jul 18, 2012 Jul 18, 2012

Copy link to clipboard

Copied

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;

TOPICS
ActionScript

Views

899

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 18, 2012 Jul 18, 2012

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

...

Votes

Translate

Translate
Community Expert ,
Jul 18, 2012 Jul 18, 2012

Copy link to clipboard

Copied

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);

}


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 19, 2012 Jul 19, 2012

Copy link to clipboard

Copied

I had no change. Maybe it's because I don't understand what you mean with this:

heading != headings.

Thank you for your help

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 19, 2012 Jul 19, 2012

Copy link to clipboard

Copied

you have a typo in your code.  you used heading and headings.  those are not the same.

copy and paste the code i suggested.  if you don't see any change in your heading span, change the color in the css to make it obvious it's working.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 19, 2012 Jul 19, 2012

Copy link to clipboard

Copied

Thank you it works

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 19, 2012 Jul 19, 2012

Copy link to clipboard

Copied

LATEST

you're welcome.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines