PDA

View Full Version : preloaders and dynamic text content (css)


claudia
09-06-2005, 11:08 AM
Hi, Im having lots of trouble to preload dynamic content. Basically I have a main movie wich loads into an empty Movie clip (content) an external swf wich has a preloader (doesnt work) for a dynamic text Field, with some code to bring text from an external txt File and a CSS sheet for formatting. No preloader works till now. Is there anything special I have to do beacuse its an external text file, has css, and a scrollbar?

this is the code to load the text and format it:


stop()

_root.$TEXTO = "loremipsum.txt";

var cssEstilo:TextField.StyleSheet = new TextField.StyleSheet();
var myCSS:String = "./css/estilos.css";

var datos = new LoadVars();

miTextField.type = "Dynamic";
miTextField.border = false;
miTextField.html = true;
miTextField.multiline = true;
miTextField.wordWrap = true;
miTextField.condenseWhite = true;

mitextField.borderColor = "0xcccccc";
miTextField.selectable = true;
miTextField.embedFonts = false;
miTextField.text = "Loading data..."



cssEstilo.onLoad = function(bLoaded:Boolean):Void {

if (bLoaded) {
miTextField.styleSheet = this;
var tipoTxt = _root.$TEXTO.split(".")

switch (tipoTxt[1]) {
case "php":
var contenido = "lib/" + _root.$TEXTO;
datos.lang = _root.$LANG;
datos.sendAndLoad(contenido, datos, "POST");
datos.onLoad = function() {
miTextField.htmlText = "Loading data...";

}
default:
var contenido = "./lang/" + _root.$LANG + "/" + _root.$TEXTO;
datos.load(contenido);
datos.onLoad = function() {
miTextField.htmlText = datos.contenido;

}
}
}
};



too confusing? thanks so much

Xeef
09-06-2005, 11:50 AM
yes confusing NOT enought INFO


_root.createTextField("_txt", 1, 0, 0, 400, 300);
_txt.border = true;
_txt.html = true;
var my_lv = new LoadVars();
my_lv.onLoad = function(success) {
delete timer_mc.onEnterFrame;
_root._txt.htmlText = "Text Loaded Loading CSS";
_root.my_styleSheet.load("styles.css");
if (success) {
_root.TXT = this.TXT;
} else {
trace("An error occurred while loading variables.");
}
};
this.createEmptyMovieClip("timer_mc", 999);
timer_mc.onEnterFrame = function() {
var L = my_lv.getBytesLoaded();
var T = my_lv.getBytesTotal();
if (T != undefined) {
_root._txt.htmlText = "Loaded "+L+" of "+T+" bytes.";
}
};
var my_styleSheet = new TextField.StyleSheet();
my_styleSheet.onLoad = function(success) {
if (success) {
_root._txt.styleSheet = my_styleSheet;
_root._txt.htmlText = _root.TXT;
} else {
trace("Error loading CSS");
}
};
my_lv.load("TXT.txt");


.Xeef {
font-size: 18px;
font-weight: bold;
color: #0000FF;
}
.red {
color: #FF0000;
}
.green {
color: #00FF00;
}



TXT=<p class='red'>Hallo </p><p class='green'>By</p><p class='Xeef'> Xeef ---</p><p class='red'>Hallo </p><p class='green'>By</p><p class='Xeef'> Xeef ---</p><p class='red'>Hallo </p><p class='green'>By</p><p class='Xeef'> Xeef ---</p><p class='red'>Hallo </p><p class='green'>By</p><p class='Xeef'> Xeef ---</p><p class='red'>Hallo </p><p class='green'>By</p><p class='Xeef'> Xeef ---</p><p class='red'>Hallo </p><p class='green'>By</p><p class='Xeef'> Xeef ---</p><p class='red'>Hallo </p><p class='green'>By</p><p class='Xeef'> Xeef ---</p><p class='red'>Hallo </p><p class='green'>By</p><p class='Xeef'> Xeef ---</p><p class='red'>Hallo </p><p class='green'>By</p><p class='Xeef'> Xeef ---</p><p class='red'>Hallo </p><p class='green'>By</p><p class='Xeef'> Xeef ---</p><p class='red'>Hallo </p><p class='green'>By</p><p class='Xeef'> Xeef ---</p><p class='red'>Hallo </p><p class='green'>By</p><p class='Xeef'> Xeef ---</p><p class='red'>Hallo </p><p class='green'>By</p><p class='Xeef'> Xeef ---</p><p class='red'>Hallo </p><p class='green'>By</p><p class='Xeef'> Xeef</p>



[useastags]


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

claudia
09-06-2005, 01:46 PM
OSTRAS Xeef, thanks so much, really,
Right now Im testing and it works. If its not too much, do you know I can put (and where) a loading progress bar? sorry, anyway Im totally satisfied, danke
:)

Xeef
09-06-2005, 04:00 PM
//
//a ProgressBar needs to by in the Library
import mx.controls.ProgressBar;
createClassObject(ProgressBar, "PBar", 9999, {_y:200});
PBar.mode = "polled";
PBar.source = my_lv;
//
my_lv.load("TXT.txt");
//
//P.S the load of the CSS can NOT by observed