Posted By


danideu on 10/18/06

Statistics


Viewed 631 times
Favorited by 1 user(s)

Precargador dinamico adaptable


/ Published in: ActionScript
Save to your folder(s)

Aligerar el tiempo en crear mis precargas ... lo bueno de esto es que se adapta al tamaño del escenario del flash .. y todo es dinamico


Copy this code and paste it in your HTML
  1. stop();
  2. //Alexis Garrido
  3. //Web Developer
  4. onEnterFrame = function () {
  5. var r = Math.round((getBytesLoaded()/getBytesTotal())*100);
  6. cor_y = Stage.height/2;
  7. cor_x = Stage.width/2;
  8. this.createTextField("carga", 102, cor_x-41, cor_y-2.6, 100, 20);
  9. this.createEmptyMovieClip("barra", 100);
  10. barra.beginFill(0xFFFFFF);
  11. barra.moveTo(0, 0);
  12. barra.lineTo(200, 0);
  13. barra.lineTo(200, 10);
  14. barra.lineTo(0, 10);
  15. barra.lineTo(0, 0);
  16. barra.endFill();
  17. this.createEmptyMovieClip("des", 101);
  18. des.beginFill(0xCCCCCC);
  19. des.moveTo(0, 0);
  20. des.lineTo(200, 0);
  21. des.lineTo(200, 10);
  22. des.lineTo(0, 10);
  23. des.lineTo(0, 0);
  24. des.endFill();
  25. des._x = cor_x-105;
  26. des._y = cor_y;
  27. des._xscale = r;
  28. barra._x = cor_x-105;
  29. barra._y = cor_y;
  30. barra._xscale = 100;
  31. var formato:TextFormat = new TextFormat();
  32. formato.color = 0x000000;
  33. formato.bold = true;
  34. formato.size = 10;
  35. formato.font = "Arial";
  36. carga.text = "Cargando "+r+"%";
  37. carga.setTextFormat(formato);
  38. if (r == 100) {
  39. delete onEnterFrame;
  40. carga._visible = 0;
  41. barra._visible = 0;
  42. des._visible = 0;
  43. play();
  44. }
  45. };

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.