flash: text preloader
- Started
- Last post
- 5 Responses
- pkny
how do i make a preloader for loading text / variables from an external source?
thx in adv.
- Anarchitect0
make a LoadVars object.
use the following sysntax toload your content:
myobj.load("mytxt.txt");
and then just target your object within a loop.
check if myobj.getBytesLoaded() == myobj.getBytesTotal() && myobj.getBytesTotal() > 10 [this last one is to avoid a samll null file bug]..
- pkny0
thx arch.
i tried this and its' giving me hell.. i'm trying to make a laod status.. but getoadedbytes dont return values.. i have a feelling i've placed in the wrong location..
data = new LoadVars();
data.load("text.txt");
data.onLoad = function(a){if (a) {
textbox.htmlText = this.text;
debug.htmlText = this.debug;
debug.htmlText = "GOOD";
//debug.htmlText = data.getBytesLoaded() + " / " + data.getBytesTotal()gotoAndPlay(3);
} else {debug.htmlText = "HELP" ; //data.getBytesLoaded() + " / " + data.getBytesTotal()
//gotoAndPlay(2);}
};
- dijitaq0
you have to put the bytes loaded variable in a enterFrame function or interval
var checkLoad = function (target) {
var bytesLoaded:Number = target.getBytesLoaded();
var bytesTotal:Number = target.getBytesTotal();
//
target.getBytesLoaded( ) + " / " + target.getBytesTotal()
];var checkPreloadInt:Number = setInterval(checkLoad, 50, data);
- Visia0
PKNY, no offense intended but I have to say it:
RTFM
- Visia0
and I don't mean that in a bad way. What I do mean is that you'll glean more info from the Help files if you learn to understand them.
Don't get me wrong, theyr'e written in latin as far as I'm concerned. But, once you finally learn to read them it all becomes very clear.
Good luck and best wishes.