Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 17-12-2004, 17:31   #1 (permalink)
Pending…
 
Benutzerbild von psyk
 
Registriert seit: Jul 2002
Ort: Hamburg
Beiträge: 3.866
if Anweisung, geht das auch kürzer?

Hallo Leute,
hab nen Preloader mit ladebalken (prozent_mc) der alle 10% um einen bestimmten gleichbleibenden Wert wächst.
Frage:
Kann man die ganzen if's nicht ein bissel verkürzen?
ActionScript:
  1. _root.loader_mc._visible = false;
  2. ladeDatei = function (Datei) {
  3.     _root.target_mc.loadMovie(Datei);
  4.     _root.loader_mc._visible = true;
  5.     _root.loader_mc.prozent_mc._xscale = 0;
  6.     _root.loader_mc.onEnterFrame = function() {
  7.         var geladen = _root.target_mc.getBytesLoaded();
  8.         var zuladen = _root.target_mc.getBytesTotal();
  9.         var prozent = Math.round(geladen/zuladen*100);
  10.         this.prozent_txt.text = prozent+" %";
  11.         // ::: Um diese hier gehts :::.
  12.         if (geladen<=10) {
  13.             this.prozent_mc._xscale = 10;
  14.         } else {
  15.             if (prozent<=20) {
  16.                 this.prozent_mc._xscale = 20;
  17.             } else {
  18.                 if (prozent<=30) {
  19.                     this.prozent_mc._xscale = 30;
  20.                 } else {
  21.                     if (prozent<=40) {
  22.                         this.prozent_mc._xscale = 40;
  23.                     } else {
  24.                         if (prozent<=50) {
  25.                             this.prozent_mc._xscale = 50;
  26.                         } else {
  27.                             if (prozent<=60) {
  28.                                 this.prozent_mc._xscale = 60;
  29.                             } else {
  30.                                 if (prozent<=70) {
  31.                                     this.prozent_mc._xscale = 70;
  32.                                 } else {
  33.                                     if (prozent<=80) {
  34.                                         this.prozent_mc._xscale = 80;
  35.                                     } else {
  36.                                         if (prozent<=90) {
  37.                                             this.prozent_mc._xscale = 90;
  38.                                         } else {
  39.                                             if (prozent<=100) {
  40.                                                 this.prozent_mc._xscale = 100;
  41.                                             }
  42.                                         }
  43.                                     }
  44.                                 }
  45.                             }
  46.                         }
  47.                     }
  48.                 }
  49.             }
  50.         }
  51.         // .::: Um diese hier gehts :::
  52.         if (prozent>=100) {
  53.             delete this.onEnterFrame;
  54.             this._visible = false;
  55.         }
  56.     };
  57. };
__________________
:: Warum einfach, wenn's auch kompliziert geht! ::
psyk ist offline   Mit Zitat antworten
Alt 17-12-2004, 17:46   #2 (permalink)
Gelegenheits-DAU
 
Benutzerbild von TOAOTC
 
Registriert seit: May 2003
Ort: Schwerin - come to where the Hecht beißt
Beiträge: 187
ActionScript:
  1. // ::: Um diese hier gehts :::.
  2. this.prozent_mc._xscale = prozent + (10 - (prozent%10));
  3. // .::: Um diese hier gehts :::
  4.  

war 'n test, oder?
;-)

Gruß
TOAOTC ist offline   Mit Zitat antworten
Alt 17-12-2004, 17:52   #3 (permalink)
Pending…
 
Benutzerbild von psyk
 
Registriert seit: Jul 2002
Ort: Hamburg
Beiträge: 3.866
Leider nicht.
Funkt aber.

Dank dir!
__________________
:: Warum einfach, wenn's auch kompliziert geht! ::
psyk 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 15:35 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele