Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 01-03-2004, 15:55   #1 (permalink)
Neuer User
 
Registriert seit: Jul 2003
Ort: berlin
Beiträge: 14
komplette bytes statt bilderanzahl

bei diesem preloader würde ich gern anstelle von "n", also der anzahl der bilder, die totalen bytes haben als wert haben, denn so läuft die balken- bzw. prozentanzeige schrittweise, nicht fliessend, denn das script teilt die 100% ja dadurch durch die bilderanzahl und zeigt demnach die geladenen prozent an. bei 20 bildern z.b. 5, 10, 15, 20, ...

irgendwelche vorschläge, wie ich das am besten umschreibe um winzig kleine schritte zu haben?

hier das script:

ActionScript:
  1. stop();
  2. _global.nr=1; //curentpictureshowing
  3. loadText = new LoadVars();
  4. //very important for centering
  5. _global.wd=760; //movie width
  6. _global.ht=475; //movie height
  7. i=1;
  8. m=1;
  9. m2=1;
  10. count=0;
  11. ind=1;
  12. //loadign the number of pictures from the external file
  13. loadText.onLoad = function(success) {
  14.   if (success) {
  15.                 number1 = this.number1;
  16.                 n = Number(number1);
  17.  
  18. //loading the pictures&thumbs            
  19. for (i=1;i<=n;i++)
  20. {
  21.     _root.createEmptyMovieClip("c"+i,i);
  22.     loadMovie("images/"+i+".jpg","c"+i);
  23.     //setting initial state invisible
  24.     _root["c"+i]._alpha=0;
  25. }
  26. _root.onEnterFrame = function()
  27. {
  28. if(m<=n)
  29.     {
  30.      //preloading
  31.  if(_root["c"+m].getBytesLoaded() == _root["c"+m].getBytesTotal())
  32.  {
  33.  count++;
  34.  m++;
  35.  }
  36.  //procent preloader
  37.  _root.per = Math.round(count/n*100);
  38.  percentSetup = Math.round(count/n*100);
  39.  setProperty("_root.ladebalken", _xscale, percentSetup);
  40.  
  41.  }
  42.  else m=1;
  43.  if (count==n) _root.gotoAndStop(3);
  44. }
  45.  
  46. MovieClip.prototype.fadeall = function()
  47. {
  48.     for (i=1;i<=n;i++)
  49.     _root["c"+i].fadeout(0,10);
  50. }
  51. //the functiosn that controls wich picture to be displayed
  52. MovieClip.prototype.place = function(par)
  53. {
  54. this.onEnterFrame = function()
  55. {
  56. _root.fadeall();
  57. if(_global.nr==n+1) _global.nr=1;
  58. if (_global.nr==0) _global.nr=n;
  59. par=_global.nr;
  60. _root["c"+par].center();
  61. _root["c"+par].fadein(100,10);
  62. }
  63. }
  64.  
  65. }
  66. };
  67. loadText.load("no.txt");
  68.  
  69. //these are my personal fadein and fadeout functions !!!
  70. MovieClip.prototype.fadein = function(mx,sp)
  71. {
  72. this._visible=1;   
  73. this.onEnterFrame = function()
  74. {
  75. if(this._alpha<mx)this._alpha+=sp;
  76. }
  77. }
  78. MovieClip.prototype.fadeout = function(fin,spe)
  79. {
  80. this.onEnterFrame = function()
  81. {
  82. if(this._alpha>fin)this._alpha-=spe;
  83. else
  84. {
  85. this._visible=0;
  86. }
  87. }
  88. }
  89. //centering
  90. MovieClip.prototype.center = function()
  91. {
  92.     this._x=_global.wd/2 - this._width/2;
  93.     this._y=_global.ht/2 - this._height/2;
  94. }

nachdem mir hier neulich schon keiner wirklich geholfen hat, hoffe ich diesmal auf rege anteilnahme.
__________________
what you see is not what you get.
angelcurls ist offline   Mit Zitat antworten
Alt 01-03-2004, 16:47   #2 (permalink)
Flash & TYPO3
 
Registriert seit: Oct 2003
Ort: Bayern
Beiträge: 2.700
Wie wär's mit eigenen Ansätzen? Eigetnlich interessiert ja nur der Teil:
ActionScript:
  1. _root.onEnterFrame = function()
  2.                 {
  3.                         if(m<=n)
  4.                         {
  5.                                 //preloading
  6.                                 if(_root["c"+m].getBytesLoaded() == _root["c"+m].getBytesTotal())
  7.                                 {
  8.                                         count++;
  9.                                         m++;
  10.                                 }
  11.                                 //procent preloader
  12.                                 _root.per = Math.round(count/n*100);
  13.                                 percentSetup = Math.round(count/n*100);
  14.                                 setProperty("_root.ladebalken", _xscale, percentSetup);
  15.                                
  16.                         }
  17.                         else m=1;
  18.                         if (count==n) _root.gotoAndStop(3);
  19.                 }

Vielleicht werden dann ja nicht ganz so viele vom vielen Code abgeschreckt
__________________
Mediendesign-Student
johanness ist offline   Mit Zitat antworten
Alt 01-03-2004, 17:39   #3 (permalink)
Neuer User
 
Registriert seit: Jul 2003
Ort: berlin
Beiträge: 14
eigene gedanken...hm...


mein logischer ansatz wäre zu sagen:

ActionScript:
  1. //anstelle von dem hier
  2.  
  3. _root.per = Math.round(count/n*100);
  4.                                 percentSetup = Math.round(count/n*100);
  5.                                 setProperty("_root.ladebalken", _xscale, percentSetup);
  6.  
  7. //das hier
  8.  
  9. gesamt = _root["c"+m].getBytesTotal();
  10. geladen = _root["c"+m].getBytesLoaded();
  11. _root.per = Math.round(geladen/gesamt*100);
  12.                                 percentSetup = Math.round(geladen/gesamt*100);
  13.  
  14. setProperty("_root.ladebalken", _xscale, percentSetup);

aber das funzt nicht.
__________________
what you see is not what you get.
angelcurls ist offline   Mit Zitat antworten
Alt 04-03-2004, 11:00   #4 (permalink)
Neuer User
 
Registriert seit: Jul 2003
Ort: berlin
Beiträge: 14
also seit ich mich hier angemeldet habe, ist mir noch nicht einmal geholfen worden...frage mich langsam wozu ich hier überhaupt was reinschreibe.

so schwer kann doch die lösung nicht sein. ich meine logisch gesehen muss ja für "n" nur die gesamt-kb-zahl eingesetzt werden, bzw der wert, der die berechnet, nur habe ich leider nicht so wirklich ahnung von as, deswegen bin ich ja hier.

wäre also wunderbar wenn sich irgendwer mal erbarmen könnte und mir auf die sprünge hilft.

danke.
__________________
what you see is not what you get.
angelcurls ist offline   Mit Zitat antworten
Alt 10-03-2004, 11:58   #5 (permalink)
Neuer User
 
Registriert seit: Jul 2003
Ort: berlin
Beiträge: 14
Unhappy

will mir keiner helfen...

ich komm einfach auf keine lösung.
__________________
what you see is not what you get.
angelcurls ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 20:33 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele