Skip navigation
Currently Being Moderated

External CSS Styling Not Being Applied

Jul 3, 2012 12:08 PM

Tags: #html #actionscript #actionscript3 #external_css #parsing_css #parsing_external_css #external_html #external_css_not_loading

I've a manually created text field, newsText_tf, into which I am able to load text. The text file, writeUp1.txt, is definitely getting loaded, but the CSS styling found in "newsStyle.css" in not getting applied, or loaded at all.:mad:



I slipped in a few trace commands and supposed the CSS is getting loaded, or at least the function in which the trace code is found is getting read.:p



Anyway, here's the code:



var navBanNews:URLRequest = new URLRequest("content_news/writeUp1.txt");
var newsLoader:URLLoader = new URLLoader(navBanNews);
var cssLoader:URLLoader = new URLLoader();

//Load the text file ("writeUp1.txt")
newsLoader.addEventListener(Event.COMPLETE, newsLoadCompleted);
function newsLoadCompleted(event:Event):void
          var newsLoaded:URLLoader = URLLoader(;
          newsBox_mc.newsText_tf.htmlText =;
                    trace("Text loaded!");

//Load the CSS file ("newsStyle.css")
function callCss():void
          var newsStyleRequest:URLRequest = new URLRequest("content_news/newsStyle.css");
          cssLoader.addEventListener(Event.COMPLETE, cssLoadComplete);
                    trace("CSS loaded!");

function cssLoadComplete(event:Event):void

          var newsStyle:StyleSheet = new StyleSheet();
          newsBox_mc.newsText_tf.styleSheet = newsStyle;
          newsBox_mc.newsText_tf.wordWrap = true;
                    trace("CSS load complete!");



I don't know if it means anything, but when I Test the movie, the "CSS loaded" trace is displayed first in the Output panel.

  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 3, 2012 12:14 PM   in reply to Slateclean

    i don't see how newsLoadCompleted is called so none of those traces will execute.

    Mark as:
  • Currently Being Moderated
    Jul 3, 2012 1:13 PM   in reply to Slateclean

    what kind of tags do you use?, this link show the supported tags in Flash


    Mark as:
  • Currently Being Moderated
    Jul 3, 2012 4:45 PM   in reply to Slateclean

    I test your code and  in fact don't works.


    I only can change the link color




        color: #FF0000;




    but I can't change the color or size of the text. the color and size is defined only by  the panel control.


    I created dynamicly a textFild but the result is same



    Maybe is a bug, I tested this in Flash CS6

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points