CSS styling from AS, not external file
I'm trying to apply some simple CSS coding to an html'd dynamic text box, from *inside* Flash 8, with AS, rather than from an external .css doc.
I found the code below online; it is similar to many others I've seen. I think it should work, but doesn't. (I tried adding a period in front of customClass--nuthin'; I also tried taking out the fontFamily altogether, as I'm on a Mac and I've heard bad things.)
I'd like eventually to modify it to allow loading from an html'd external file, which I generally know how to do. I've tried coding that purports to apply ActionScript-based CSS styles in that circumstance, but I couldn't get them to work either.
Frankly, I've tried this on two other forums and no one's replied.
Any ideas? TIA.
/*
var styles = new TextField.StyleSheet();
styles.setStyle("p", {textDecoration:"none", color:"#000000"});
styles.setStyle("customClass", {fontFamily:"_serif",fontWeight:'bold', color:"#FF0000", fontSize:'24px'});
html_fld.html = true;
html_fld.styleSheet = this.styles;
html_fld.htmlText = "<p class='customClass'>Should be red</p><p>Should be black and <span class='customClass'>red again</a></span></p>";
*/
Global styling from within actionscript
Hi guys,
Sorry for butting in here but I'm trying to figure out this stuff myself, maybe you can help.
I have a bunch of dynamic text boxes in my movie, and I want to be able to control the text color via CSS in the Actionscript (not an external file, as this is for deployment on a handheld device - flash lite).
I thought I had my answer from this thread, but it seems from the code above that you must specify the instance name of each text box you want to change to achieve the desired effect (i.e. html_fld.styleSheet = this.styles;).
Does anyone know of an easy way to set all text boxes to use the same style? Something like *.styleSheet = this.styles; (but obviously that's not the answer).
What I'm hoping is to have the content of every text box wrapped in a span tag, and then I'd just have to change the CSS once in the AS to have all text color change.