terça-feira, setembro 26, 2006

Preloader básico

Como sempre faço em exemplos, o movie clip "bar" não existe no stage até o filme ser acessado :D


var bar:MovieClip = this.createEmptyMovieClip("bar_mc",9)
bar.beginFill(0xffcc00)
bar.lineTo(400,0)
bar.lineTo(400,15)
bar.lineTo(0,15)
bar._x = 200
bar._y = Stage.height / 2
bar.endFill()

bar._xscale = 0;
this.onEnterFrame = function (){
var n= (this.getBytesLoaded() * 100) / this.getBytesTotal();
bar._xscale = n
if (this.getBytesLoaded() >= this.getBytesTotal()) {
gotoAndPlay(2);
this.onEnterFrame = null;
}
}
stop();

Um comentário:

ddmartins disse...

Esse código tá com bug, não valida no FLASH.