Hi guys,
I was trying to create a preloader that preloads content loaded by the LoadVars() Object. For some reason, the getBytesLoaded and getByetesTotal variables of the LoadVars object kept retuning a null value. Below’s how I do it:
var news_lv = new LoadVars();
var url = "news.aspx"
news_lv.load(url);
//////////////////////Preload Content///////////////////////////
var bytes_loaded = news_lv.getBytesLoaded();
var bytes_total = news_lv.getBytesTotal();
var getPercent = bytes_loaded/bytes_total;
this.loadBar._width = getPercent*100;
//loadText is the variable name of a textfield that
//resides within the loadText_mov mc
loadtext_mov.loadText = Math.round(getPercent*100)+"% Loaded";
if ( Math.round(getPercent*100) >= 50 ) {
my_color = new Color(loadBar);
my_color.setRGB(0xFF0000);
}
if (bytes_loaded == bytes_total) {
this.gotoAndPlay(3);
}
//////////////////////////////////////////////////////////////
news_lv.onLoad = function(success)
{
if ( success )
{
//some other codes
}
}
Any clue what’s wrong? Thanks in advance.