Il s'agit du code preloader que j'ai utilisé sur playbball. com.
J'ai utilisé deux bars et son genre d'un coup de chance, mais quelle que soit ordonné. motion Ones est lissée et l'autre non:
private function progress(erogressEvent):void // update preloader
{
var temp:int;
temp = (e.bytesLoaded / e.bytesTotal) * 100;
m_textfield.text = temp + " / 100";
mysquare.width = 700 - (700 * (e.bytesLoaded / e.bytesTotal));
mysquare.x = mysquarex + (700 * (e.bytesLoaded / e.bytesTotal));
progressWidth2 = 700 - (7 * (temp));
triangleShape.x = mysquarex + (680 * (e.bytesLoaded / e.bytesTotal));
if (e.bytesLoaded / e.bytesTotal == 1) {
//removeEventListener(Event.ENTER_FRAME, checkFrame);
boolLoaded = true;
}
}
private function doFrame(e:Event):void
{
var time2:int = getTimer();
var timeDelta:int = time2 - time;
time = time2;
triangleShape.rotation = triangleShape.rotation + (timeDelta >> 3);
var tempMovement:int; var distanceMultiplier:int;
distanceMultiplier = (mysquare2.width - progressWidth2) / 5
tempMovement = (timeDelta >> 5) * distanceMultiplier;
if(mysquare2.width - tempMovement < progressWidth2)
{
mysquare2.width = progressWidth2;
}
else
{
mysquare2.width -= tempMovement;
}
}
- private function progress(erogressEvent):void // update preloader
- {
- var temp:int;
- temp = (e.bytesLoaded / e.bytesTotal) * 100;
- m_textfield.text = temp + " / 100";
-
- mysquare.width = 700 - (700 * (e.bytesLoaded / e.bytesTotal));
- mysquare.x = mysquarex + (700 * (e.bytesLoaded / e.bytesTotal));
-
- progressWidth2 = 700 - (7 * (temp));
-
- triangleShape.x = mysquarex + (680 * (e.bytesLoaded / e.bytesTotal));
-
- if (e.bytesLoaded / e.bytesTotal == 1) {
- //removeEventListener(Event.ENTER_FRAME, checkFrame);
- boolLoaded = true;
- }
- }
-
- private function doFrame(e:Event):void
- {
- var time2:int = getTimer();
- var timeDelta:int = time2 - time;
- time = time2;
-
- triangleShape.rotation = triangleShape.rotation + (timeDelta >> 3);
-
- var tempMovement:int; var distanceMultiplier:int;
- distanceMultiplier = (mysquare2.width - progressWidth2) / 5
- tempMovement = (timeDelta >> 5) * distanceMultiplier;
-
- if(mysquare2.width - tempMovement < progressWidth2)
- {
- mysquare2.width = progressWidth2;
- }
- else
- {
- mysquare2.width -= tempMovement;
- }
-
- }