Hi Kirupa Forum ( 1st post )
I made a preloader, and it work’s fine in my IDE of flash CS3(fllashplayer 9 installed).
But when i put it on the server, and run it my browser with FP 10 installed,
it seems like the **bytestTotal ** and bytesLoaded values are the same.
They are increasing simultaneous.
If i give a constant value instate of bytesTotal, it work’s
Has anybody the same troubles?
Here is my preloader which should be ok:
//import gs.*;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
var contentLoadArea:MovieClip;
var contentLoader:Loader;
var loaded:Number;
//var swfPath:String="some.swf" +"?d=" + String(new Date().day);
var swfPath:String="some.swf";
//--> LOAD CONTENT
contentLoader = new Loader();
//contentLoaderInfo
contentLoader.load(new URLRequest(swfPath));
contentLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, contentLoading);
contentLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, contentLoaded);
//--> LOADING IN PROGRESS
function contentLoading(e:ProgressEvent):void {
loaded = e.currentTarget.bytesLoaded /e.currentTarget.bytesTotal;
bytes_tf.text=String(e.currentTarget.bytesLoaded); //debugfield1
total_tf.text=String(e.currentTarget.bytesTotal); //debugfield2
prozent_mc.prozent_txt.text= String(int(loaded*100));
preloader_mc.preloader_bar_mc.width = loaded * preloader_mc.preloader_background_mc.width;
}
//--> LOADING COMPLETE
function contentLoaded(e:Event):void {
// some tweening
//TweenLite.to(preloader_mc, 1,{alpha:0, delay:0.2});
//TweenLite.to(prozent_mc, 1.2,{alpha:0, delay:0.2, onComplete:endOfPreloading});
endOfPreloading();
}
//--> SHOW CONTENT
function endOfPreloading():void{
contentLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, contentLoading);
contentLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, contentLoaded);
removeChild(preloader_mc);
removeChild(prozent_mc);
contentLoadArea = MovieClip(contentLoader.content);
addChild(contentLoadArea);
contentLoader = null;
}
stop();