FORUMS: list search recent posts

loading external text AND css

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
MadMac66
loading external text AND css
on Jul 12, 2007 at 5:50:10 pm

Hi, I am having difficulty loading external text and applying an external style sheet to it. I can load an external .txt or .htm file and apply hard-coded internal styles. Or I can load external CSS file and apply to hard-coded internal dynamic text.

I am doing this by using this code on a frame looking for a text box called myText:

var styles:TextField.StyleSheet = new TextField.StyleSheet();
styles.load("bpsw_styles.css" ; // this load call breaks the function, the internal styles described below work fine

styles.setStyle("html", {fontFamily:'Verdana,Arial', fontSize:'12px', color:'#ffffff'});
styles.setStyle("body", {color:'#ffffff'});
styles.setStyle("h1", {fontFamily:'Verdana,Arial', fontSize:'24px', color: '#ffffff'});

styles.onLoad = function(loaded) {
if (loaded) {
myText.styleSheet = styles;
} else {
myText.text = "Error loading CSS file!";
}
};
// used on its own, this code below applies the internal styles described above
//myText.styleSheet = styles;
//myText.html = true;

var myVars:LoadVars = new LoadVars();
myVars.onData = function(myStr:String):Void{
if (myStr != undefined){
myText.text = myStr;
} else {
trace("unable to load text") ;
}
}
myVars.load("greek.htm" ) ;

I know there has to be a specific sequence for doing this correctly, or some other more efficient way. Please help if you can I have been trying to figure ths out for hours now.

thanks
adam


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]