No worries miles, whenever im stuck on a bug I just can't figure it's usually something easily overlooked... Fresh eyes minds can make all the difference, helps to come at the blighters from a different perspective.

Andy,

Thank you - cut and pasted your styles into styles.css, and it worked.

Hmmm. Looked VERY CAREFULLY at my definitions. Sure enough, in one style definition I had a "(" instead of "{".

They look v. different here, but that pathetic parenthetic error looked like a bodacious brace in UltraEdit, and I had only a half-dozen styles to check!!

Regards, and thanks again - Miles Thompson

At 10:12 PM 11/17/2005, you wrote:

I copied that into a test fla and all works fine for me...

is your css valid? Heres some simple test rules:

p {
 color: #000000;
 font-family: Arial,Helvetica,sans-serif;
 font-size: 12px;
 display: inline;
}

a:link {
 color: #FF00FF;
 text-decoration: underline;
}

a:hover{
 color: #999999;
 text-decoration: none;
}

.headline {
 color: #0000FF;
 font-family: Arial,Helvetica,sans-serif;
 font-size: 18px;
 font-weight: bold;
 display: block;
}

.byline {
 color: #666600;
 font-style: italic;
 font-weight: bold;
 display: inline;
}


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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to