Following examples from livedocs, help and a couple of tutorials, I've tried to load a style sheet into my movie.

Nothing radical, the style sheet is named "styles.css" and is located in the same directory as the .swf.

A new TextField.StyleSheet() object has been created. (Actually, all of the code I just cut and pasted from MM's livedocs, changing a couple of variable names. So I have the .load and .onLoad methods, yet never success - always the "Styles failed to load" message.

Do I have to place styles.css on the web server alongside the scripts which feed data to the movie and fetch it from there?

Suggestions and guidance, as always, will be welcome, code fragment is below.

Thanks for looking at this - Miles Thompson



Here's the code, much of it will look familiar ...

var myCSS:TextField.StyleSheet = new TextField.StyleSheet();
var cssURL:String = "styles.css";

myCSS.onLoad = function(success:Boolean) {
        if (success) {
                trace("Styles loaded:");
                var styles_array:Array = myCSS.getStyleNames();
                trace(styles_array.join(newline));
                
                txtNews.styleSheet = myCSS;
                txtHead.styleSheet = myCSS;
        } else {
                trace("Styles failed to load.");
        }
};

myCSS.load(cssURL);


_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to