PDA

View Full Version : help correct my script


NapalmDeath
01-08-2008, 01:00 AM
Hi There,

I'm just trying to load an external html file (home.html) into my dynamic text box (hometxt) while also assigning a style sheet to it.

Now i see to remember this script was fine in flash8 but in CS3 its producing a "syntax error" for the line that is highlighted.

No matter what i change it still doesn't work. Any pointers on where I'm going wrong ?

hometxt.border = true;
hometxt.html = true;
hometxt.multiline = true;
hometxt.wordWrap = true;

var myVars_lv:LoadVars = new LoadVars();
var styles:TextField.StyleSheet = new TextField.StyleSheet();

var txt_url:String = "text_files/home.html";
var css_url:String = "text_files/jackie.css";


styles.onLoad = function(success:Boolean):Void {
if (success) {
hometxt.styleSheet = styles;
} else {
trace("Unable to load CSS file.");
}
};
styles.load(css_url);

myVars_lv.onData = function(src:String):Void {
if (src != undefined) {
hometxt.htmlText = src;
} else {
trace("Unable to load HTML file");
}
};
myVars_lv.load(txt_url);

dzedward
01-09-2008, 01:49 AM
var styles:TextField.StyleSheet = new TextField.StyleSheet();

should be

ar styles:StyleSheet = new StyleSheet();

honeycloverpkiss
01-15-2008, 01:13 PM
You might find your answer here:

http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000907.html

;)