2009-10-07 5 views
0

juste une question rapide pour savoir comment faire un préchargement animer en arrière. Ainsi, la largeur de la barre diminue à mesure que le nombre de chargement augmente.Flash actionScript 2 preloader quicky

Voici mon code

onClipEvent (enterFrame) { 
    loading = _root.getBytesLoaded(); 
    total = _root.getBytesTotal(); 
    if (percent == undefined) percent = 0; 
    percent -= (percent-((loading/total)*100))*.25; 
    per = int(percent); 
    percentage = per+"%"; 
    loadBar._width = per*9.70; 
    if (percent>99) { 
     _root.gotoAndStop(2); 
    } 
} 

Un grand merci,

Matt

Répondre

1

changer la ligne

loadBar._width = per*9.70; 

dans

loadBar._width = (100 -per)*9.70; 

est une façon de le faire

2

Je pense que rapide et sale c'est plus simple:

onClipEvent (load) { 
    onEnterFrame = function() { 
     loading = _root.getBytesLoaded(); 
     total = _root.getBytesTotal(); 
     percent = Number(loading/total); 
     this._xscale = (1-percent)*100; 
     trace(percent); 
     if (percent>=1) { 
      //_root.gotoAndStop(2); 
      delete (onEnterFrame); 
     } 
    }; 
} 

Et elle s'arrêtera après conditon (pour cent> = 1) devenir vrai.

Questions connexes