Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 30-07-2004, 11:05   #1 (permalink)
flash4fun
 
Benutzerbild von cybermad
 
Registriert seit: Nov 2003
Ort: Bad Nauheim
Beiträge: 104
Probleme mit Abstand beim Verlangsamen ...

Hallo,

ich habe seit Tagen ein kleines Problem:
In meinem Movie erzeuge ich mir aus einem Array ein Menü, welches innerhalb eines bestimmten Bildschirmbereichs nach oben und nach unten gescrollt werden kann.
Soweit so gut...
Zusätzlich habe ich versucht die Scrollgeschwindigkeit abhängig von dem Abstand zum Mittelpunkt einzubauen (Sieht einfach besser aus)
Das funktioniert auch, aber leider verändern sich die Abstände zwischen den einzelnen Elementen ...

Ich hoffe, jemand kann mir helfen !!!

Um das ganze nachzubauen benötigt Ihr den folgen AS-Code und einen MovieClip mit dem Namen "mc_Navi", der ein Textfeld mit dem Namen "txtLink" enthalten sollte.

Ich würde mich freuen, wenn jemand einen Tip für mich parat hat.
Besten Dank im Voraus !

cybermad :-)

ActionScript:
  1. var myNavi=new Array();
  2.  
  3. myNavi[0]="contact";
  4. myNavi[1]="links";
  5. myNavi[2]="home";
  6. myNavi[3]="about";
  7. myNavi[4]="stores";
  8. myNavi[5]="projects";
  9. myNavi[6]="customers";
  10. myNavi[7]="login";
  11.  
  12. var yAbstand=30;       // horizontaler Abstand
  13. var myX=5;
  14. var myY=0;
  15. var myAlpha=160;        // Breite der Ausblendfläche / Tranzparenz
  16. var i;
  17. var hoehe=100;      // korrekte Bühnenhöhe
  18. var breite=120;   // korrekte Bühnenbreite
  19. var tempo=0;            // Scrollgeschwindigkeit
  20. var maxtempo=1;  // maximale Scrollgeschwindigkeit
  21. var Ausblenden=true;    // Steuerung, ob Movieclips ausgeblendet werden sollen
  22. var myLevel=1;
  23. var i=0;
  24. var Anzahl=myNavi.length-1;
  25.  
  26. var hoehe=Anzahl*yAbstand;
  27. var myAlpha=hoehe/2;
  28.  
  29. Initialisieren();
  30.  
  31. /*
  32. // Dynamik  Scrollfunktionen
  33. */
  34. function Animation(){
  35.        
  36.     //befindet sich der Mauszeiger innerhalb der Bühne ?
  37.     if(_root._ymouse>=0 and
  38.        _root._ymouse<hoehe and
  39.        _root._xmouse>0 and
  40.        _root._xmouse<=breite){
  41.                
  42.         //Scroll-Richtung abhängig von Mausposition
  43.         if(_root._ymouse>=(hoehe/2)){
  44.            
  45.             // Geschwindigkeit abhängig von Distanz Mauscursor zur Mitte
  46.             tempo=(_root._ymouse*maxtempo/(hoehe/2)-maxtempo);
  47.             HochScrollen();
  48.         }else{
  49.            
  50.             // Geschwindigkeit abhängig von Distanz Mauscursor zur Mitte
  51.             tempo=(maxtempo-_root._ymouse*maxtempo/(hoehe/2));
  52.             RunterScrollen();
  53.         }
  54.                
  55.    
  56.     }else{
  57.         tempo=0;
  58.     }
  59.     // updateAfterEvent();
  60. }
  61. /*
  62. // Tranzparenz
  63. */
  64. function Tranzparenz(){
  65.  
  66.     // Ausblenden erwünscht ?
  67.     if(Ausblenden==true){
  68.        
  69.         // Tranzparenz oben
  70.         if(this["mc_"+i]._y<myAlpha){
  71.             this["mc_"+i]._alpha=(100/myAlpha)*this["mc_"+i]._y;
  72.             this["mc_"+i]._xscale=(100/myAlpha)*this["mc_"+i]._y;
  73.             this["mc_"+i]._yscale=(100/myAlpha)*this["mc_"+i]._y;
  74.         }
  75.    
  76.         // Keine Tranzparenz
  77.         if(this["mc_"+i]._y>=myAlpha and
  78.            this["mc_"+i]._y<=hoehe-myAlpha){
  79.            this["mc_"+i]._alpha=100;
  80.            this["mc_"+i]._xscale=100;
  81.            this["mc_"+i]._yscale=100;
  82.         }
  83.    
  84.         // Tranzparenz unten
  85.         if(this["mc_"+i]._y>hoehe-myAlpha){
  86.             this["mc_"+i]._alpha=100/myAlpha*(hoehe-this["mc_"+i]._y);
  87.             this["mc_"+i]._xscale=100/myAlpha*(hoehe-this["mc_"+i]._y);
  88.             this["mc_"+i]._yscale=100/myAlpha*(hoehe-this["mc_"+i]._y);
  89.         }
  90.     }
  91.    
  92.    
  93. }
  94. /*
  95. // Logos nach oben Scrollen
  96. */
  97. function HochScrollen(){
  98.  
  99.     // Bewegung
  100.     for(i=0;i<=Anzahl;i++){
  101.         if (this["mc_"+i]._y+yAbstand>0){
  102.             this["mc_"+i]._y=this["mc_"+i]._y-tempo;   
  103.         }else{
  104.             this["mc_"+i]._y=this["mc_"+i]._y+((Anzahl+1)*yAbstand) - tempo;
  105.         }
  106.         Tranzparenz();
  107.        
  108.     }
  109. }
  110.  
  111. /*
  112. // Elemente nach unten Scrollen
  113. */
  114. function RunterScrollen(){
  115.     for(i=0;i<=Anzahl;i++){
  116.         if (this["mc_"+i]._y<hoehe){
  117.             this["mc_"+i]._y=this["mc_"+i]._y+tempo;   
  118.         }else{
  119.             this["mc_"+i]._y=this["mc_"+i]._y-((Anzahl+1)*yAbstand)+tempo;
  120.         }
  121.         Tranzparenz();
  122.     }
  123. }
  124.  
  125.  
  126. /*
  127. // Bühne bei Start initialisieren und benötigte Objekte erzeugen
  128. */
  129. function Initialisieren(){
  130.  
  131.     // LabelMovieClips in HauptMovieClip laden und darstellen
  132.     for(i=0;i<=Anzahl;i++){
  133.    
  134.         this.attachMovie("mc_Navi","mc_"+i,i);
  135.         this["mc_"+i]._y = myY;
  136.         this["mc_"+i]._x = myX;
  137.         this["mc_"+i].txtLink.text=myNavi[i];
  138.        
  139.         // i auf index setzen zur korrekten Verarbeitung im Link !
  140.         this["mc_"+i].id=i;
  141.        
  142.         // Animation darstellen
  143.         this["mc_"+i].onEnterFrame=function(){
  144.             Animation();
  145.            
  146.         }
  147.        
  148.         // Funktion bei Mausklick einbauen
  149.         this["mc_"+i].onPress=function(){
  150.                 trace(this.id);
  151.         };
  152.        
  153.         // Ausblenden erwünscht ?
  154.         if(Ausblenden==true){
  155.        
  156.             // Tranzparenz oben
  157.             if(this["mc_"+i]._y<myAlpha){
  158.                 this["mc_"+i]._alpha=(100/myAlpha)*this["mc_"+i]._y;
  159.                 this["mc_"+i]._xscale=(100/myAlpha)*this["mc_"+i]._y;
  160.                 this["mc_"+i]._yscale=(100/myAlpha)*this["mc_"+i]._y;
  161.             }
  162.    
  163.             // Keine Tranzparenz
  164.             if(this["mc_"+i]._y>=myAlpha and
  165.                this["mc_"+i]._y<=hoehe-myAlpha){
  166.                this["mc_"+i]._alpha=100;
  167.                this["mc_"+i]._xscale=100;
  168.                this["mc_"+i]._yscale=100;
  169.             }
  170.    
  171.             // Tranzparenz unten
  172.             if(this["mc_"+i]._y>hoehe-myAlpha){
  173.                 this["mc_"+i]._alpha=100/myAlpha*(hoehe-this["mc_"+i]._y);
  174.                 this["mc_"+i]._xscale=100/myAlpha*(hoehe-this["mc_"+i]._y);
  175.                 this["mc_"+i]._yscale=100/myAlpha*(hoehe-this["mc_"+i]._y);
  176.             }
  177.        
  178.         }
  179.         myY=myY+yAbstand;
  180.         i
  181.     }
  182.    
  183. }
__________________
alles wird gut !
cybermad 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 02:41 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele