[font=verdana, arial, helvetica][size=2]I am loading external txt into my movie and it works great when previewing but when I try to stream it I get an undefined in my dynamic text box sometimes. So I am assuming that I need an onLoad somewhere but not sure where
please help here is my code to load my txt files:
// Create a new style sheet and LoadVars object
var myVars:LoadVars = new LoadVars();
var styles = new TextField.StyleSheet();
// Location of CSS and text files to load
var txt_url = _root.subsection+".txt";
var css_url = _root.subsection+".css";
// Load text to display and define onLoad handler
myVars.load(txt_url);
myVars.onData = function(content) {
storyText = content;
};
// Load CSS file and define onLoad handler:
styles.load(css_url);
styles.onLoad = function(ok) {
if (ok) {
// If the style sheet loaded without error,
// then assign it to the text object,
// and assign the HTML text to the text field.
loadstyles();
}
};
function loadstyles() {
this[_root.subsection+“mov”][_root.subsection].styleSheet = styles;
this[_root.subsection+“mov”][_root.subsection].text = storyText;
}
Thanks,
Eric[/size][/font]