[Flash] Uhr

Dieses Thema im Forum "Webentwicklung" wurde erstellt von Knusperkeks, 18. März 2006 .

Schlagworte:
  1. 18. März 2006
    Uhr

    Das script für ne Uhr in flash .... !



    Code:
    _global.uhrmodell = this;
    //Uhr und Zeiger erstellen
    this.attachMovie("clockFace","mcClockFace",1);
    this.attachMovie("hand","mcSecondHand",4);
    this.attachMovie("hand","mcMinuteHand",3);
    this.attachMovie("hand","mcHourHand",2);
    
    //Position und Größe der Uhr 
    this.mcClockFace._x = 275-190;
    this.mcClockFace._y = 200-110;
    this.mcClockFace._height = 150;
    this.mcClockFace._width = 150;
    
    //Position, Größe und Farbe der Zeiger
    this.mcSecondHand._x = this.mcClockFace._x;
    this.mcSecondHand._y = this.mcClockFace._y;
    this.mcSecondHand._height = this.mcClockFace._height / 2.2;
    this.mcSecondHandColor = new Color(this.mcSecondHand);
    this.mcSecondHandColor.setRGB(0x000000);
    
    this.mcMinuteHand._x = this.mcClockFace._x;
    this.mcMinuteHand._y = this.mcClockFace._y;
    this.mcMinuteHand._height = this.mcClockFace._height / 2.5;
    
    this.mcHourHand._x = this.mcClockFace._x;
    this.mcHourHand._y = this.mcClockFace._y;
    this.mcHourHand._height = this.mcClockFace._height / 3.5;
    
    //Rotation der Zeiger setzen
    function updateClock(){
     if(_global.daten_uebernahme == true){
     clearInterval(t);
     }
     var now = new Date();
     var dayPercent = (now.getHours() > 12 ? now.getHours() -12 : now.getHours()) / 12;//1-12
     var hourPercent = now.getMinutes() / 60; //0-60
     var minutePercent = now.getSeconds() / 60; //0-60
     _global.uhrmodell.mcHourHand._rotation = 360 * dayPercent + hourPercent * (360 / 12);
     _global.uhrmodell.mcMinuteHand._rotation = 360 * hourPercent;
     _global.uhrmodell.mcSecondHand._rotation = 360 * minutePercent;
    }
    
    //alle 100 Millisekunden updaten
    t = setInterval(this.updateClock,100); 

    MC "clockface" ist ein Hintergrundkreis, MC "hand" ist ein Zeiger, beides mit Verknüpfungsbezeichnern in der Bibliothek.


    Muss gestehen ist nicht von mir , aber ich dachte mir das es sehr intressant für einige flash anfäger oder für leute die kein bock haben sich mit flash zu beschäftigen !


    Knusperkeks
     
  2. Video Script

    Videos zum Themenbereich

    * gefundene Videos auf YouTube, anhand der Überschrift.