Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 22-02-2004, 19:31   #1 (permalink)
brand new user
 
Benutzerbild von RustyCake
 
Registriert seit: May 2002
Ort: Laimbach 6 1/2
Beiträge: 16.884
[Stoff] Dyn. Navi. easy use!!

kleine navie die nur angebe von x_pos, y_pos, speed und hoehe der buttons braucht!!
der rest wird aus den arrys generiert!!

Viel Spaß
ActionScript:
  1. ///////////// Die Array's für das menue, die zu befüllen sind ///////////////////////////////////
  2. ///////////// Buttons werden automatisch aus diesen Array's generiert!!!////////////////////////
  3. hmenue_ary = ["section_1", "section_2", "section_3", "section_4", "section_5"];
  4. umenu_ary = [];
  5. umenu_ary[0] = ["sup_section 1_1", "sup_section 1_2", "sup_section 1_3"];
  6. umenu_ary[1] = ["sup_section 2_1", "sup_section 2_2", "sup_section 2_3", "sup_section 2_4", "sup_section 2_5"];
  7. umenu_ary[2] = ["sup_section 3_1", "sup_section 3_2", "sup_section 3_3", "sup_section 3_4"];
  8. umenu_ary[3] = ["sup_section 4_1", "sup_section 4_2"];
  9. umenu_ary[4] = ["sup_section 6_1", "sup_section 6_2", "sup_section 6_3", "sup_section 6_4"];
  10. //////////// Die vier einstellungen für das menue die nötig sind!! /////////////////////////////
  11. var mp = 5;//<---Speed des menues
  12. var xpos_hm = 60;//<--- x_position des menues
  13. var ypos_hm = 40;//<--- y_position des menues
  14. var btn_h = 20;//<-- Button_hoehe, nur bei attach nötig!!
  15. ////////////////////////////////////////////////////////////////////////////////////////////////
  16. hbtn_yo = [];
  17. hbtn_yn = [];
  18. ubtn_enco = [];
  19. hbtn_funk = [];
  20. ubtn_funk = [];
  21. sit = [];
  22. var inter = 1;
  23. for (x=0; x<hmenue_ary.length; x++) {
  24.     ubtn_funk.push([]);
  25.     ubtn_enco.push([]);
  26. }
  27. ////////////// Erstellung der section_btn's (Haubt_menue) incl. onPress function //////////////
  28. for (i=0; i<hmenue_ary.length; i++) {
  29.     this.attachMovie("base_btn", "main_btn"+i, i+1000, {_x:xpos_hm, _y:btn_h*i+ypos_hm});
  30.     this["main_btn"+i].i = i;
  31.     hbtn_yo.push(ypos_hm+btn_h*i);
  32.     hbtn_funk.push(this["main_btn"+i]);
  33.     hbtn_funk[i].texter.text = hmenue_ary[i];
  34.     und_menu(i);
  35.     hbtn_funk[i].onPress = function() {
  36.         if (hbtn_mv != this._name) {
  37.             hbtn_mv = this._name;
  38.             mm_i = this.i;
  39.             um_i = ubtn_funk[mm_i];
  40.             move_out();
  41.             move_back();
  42.             inter = ((1000/mp)*um_i.length);
  43.         }
  44.     };
  45. }
  46. ////////////////// Textfelder für die jetzigen Buttton function //////////////////////////////
  47. this.createTextField("show_me", 200, 140, 100, 500, 200);
  48. tx = new TextFormat();
  49. tx.color = 0x999999;
  50. tx.size = 28;
  51. ///////////////// Erstellung der sub_section_btn's incl. onPress function ////////////////////
  52. function und_menu(zw) {
  53.     zw_i = umenu_ary[zw];
  54.     for (i1=0; i1<zw_i.length; i1++) {
  55.         this.attachMovie("menue_btn", zw_i[i1], -i1-(20*zw), {_x:xpos_hm, _y:hbtn_yo[zw]});
  56.         ubtn_funk[zw].push(this[zw_i[i1]]);
  57.         ubtn_funk[zw][i1].texter1.text = zw_i[i1];
  58.         ubtn_enco[zw].push(hbtn_yo[zw]+btn_h*(i1+1));
  59.         ubtn_funk[zw][i1].onPress = function() {
  60.             this._parent.show_me.text = "hallo ich bin button "+this._name+" ;-)";
  61.             show_me.setTextFormat(tx);
  62.         };
  63.     }
  64. }
  65. //////////// Berechnung der endkoordinaten der Sectionbuttons (Hauptmenue) ///////////////////
  66. for (y=0; y<hmenue_ary.length-1; y++) {
  67.     hbtn_yn.push([]);
  68.     mt = umenu_ary[y];
  69.     sit.push(mt.length);
  70.     for (y1=0; y1<hmenue_ary.length-1; y1++) {
  71.         hbtn_yn[y].push(btn_h*y1+(ypos_hm+btn_h));
  72.         hbtn_yn[y][y1] += (sit[y]*btn_h);
  73.     }
  74.     hbtn_yn[y].splice(0, y);
  75. }
  76. //////////// übergibt die Buttonkoordinaten an menue_move für den vorlauf ///////////////////
  77. function move_out() {
  78.     var sID = setInterval(function () {
  79.         for (g3=0; g3<um_i.length; g3++) {
  80.             um_i[g3].menue_move(ubtn_enco[mm_i][g3], mp);
  81.         }
  82.         for (f=(mm_i+1); f<hmenue_ary.length; f++) {
  83.             hbtn_funk[f].menue_move(hbtn_yn[mm_i][f-(mm_i+1)], mp);
  84.         }
  85.         clearInterval(sID);
  86.     }, inter);
  87. }
  88. //////////// übergibt die Buttonkoordinaten an menue_move für den rücklauf /////////////////
  89. function move_back() {
  90.     for (g2=0; g2<um_izw.length; g2++) {
  91.         um_izw[g2].menue_move(hbtn_yo[mm_izw], mp);
  92.     }
  93.     for (k=(mm_izw+1); k<hmenue_ary.length; k++) {
  94.         hbtn_funk[k].menue_move(hbtn_yo[k], mp);
  95.     }
  96. }
  97. ////////////////////////// Bewegt die Buttons /////////////////////////////////////////////
  98. MovieClip.prototype.menue_move = function(hmen_btny, hspeed) {
  99.     this.onEnterFrame = function() {
  100.         if (this._y<hmen_btny) {
  101.             this._y += hspeed;
  102.             mm_izw = mm_i;
  103.             um_izw = um_i;
  104.         } else if (this._y>hmen_btny) {
  105.             this._y -= hspeed;
  106.         } else {
  107.             delete this.onEnterFrame;
  108.         }
  109.     };
  110. };
Angehängte Dateien
Dateityp: zip dyn.menue.zip (6,7 KB, 520x aufgerufen)
__________________
Bitte keine Fragen, zu Flash per PM. Dazu ist das Forum da. Danke MFG_RustyCake!
"Wer tanzen will, muß erst gehen lernen"

Geändert von RustyCake (23-02-2004 um 18:22 Uhr)
RustyCake ist offline   Mit Zitat antworten
Alt 22-02-2004, 19:35   #2 (permalink)
~~~~~~~~~~~~
 
Benutzerbild von _geo_
 
Registriert seit: May 2002
Ort: AUSTRIA (OÖ)
Beiträge: 3.298
Thumbs up

dynamisch praktisch gut !



PS.: nur mit dem speed hauts noch nicht so ganz hin ;-)

speed <= 5 ok speed = 10 ok speed 20 ok aber sonsts ... (oder is das nur bei mir so)

ansonsten find ich`s cool

mfg geo
__________________
--- :P ---

Blog
Bei unerwünschten Nebenwirkungen zerreißen Sie die Packungsbeilage oder erschlagen ihren Arzt oder Apotheker

Geändert von _geo_ (22-02-2004 um 19:51 Uhr)
_geo_ ist offline   Mit Zitat antworten
Alt 22-02-2004, 20:07   #3 (permalink)
brand new user
 
Benutzerbild von RustyCake
 
Registriert seit: May 2002
Ort: Laimbach 6 1/2
Beiträge: 16.884
Hehe! für so hohen speed wars ja auch net gedacht
über 20 verschluckt sich des setInterval wahrscheinlich!!
hab nur bis speed 10 getestet!
a bisserl was sehen sollt ma ja schon
__________________
Bitte keine Fragen, zu Flash per PM. Dazu ist das Forum da. Danke MFG_RustyCake!
"Wer tanzen will, muß erst gehen lernen"
RustyCake ist offline   Mit Zitat antworten
Alt 22-02-2004, 20:19   #4 (permalink)
Flash-holic
 
Benutzerbild von DeMoehn
 
Registriert seit: Nov 2003
Ort: Neunkirchen(Saar)
Beiträge: 988
Ich beneide immer die Leute die sowas können
DeMoehn ist offline   Mit Zitat antworten
Alt 22-02-2004, 21:25   #5 (permalink)
mod_rewrite
 
Benutzerbild von sonar
 
Registriert seit: Feb 2003
Ort: München
Beiträge: 15.621
Thumbs up

Sääähr cool rusty! Danke!
__________________
RTFM
Wie man Fragen richtig stellt.

Achim Bindannmalweg

Money makes the world go round, fear makes it turn much faster.
(New Model Army)
sonar ist offline   Mit Zitat antworten
Alt 23-02-2004, 07:20   #6 (permalink)
_//\\#//\\_
 
Benutzerbild von warrantmaster
 
Registriert seit: Jan 2003
Beiträge: 7.060
hähä...fein !



grz@froinde rusty & sonar
warrantmaster ist offline   Mit Zitat antworten
Alt 23-02-2004, 12:28   #7 (permalink)
brand new user
 
Benutzerbild von RustyCake
 
Registriert seit: May 2002
Ort: Laimbach 6 1/2
Beiträge: 16.884
Hehe! Schön wenns Euch gefällt
Ich schieb aber noch ne variante ohne setInterval nach, des is mir zu wackelig!!
Da gibts zuuviele unbekannte wie Framerate etc.
Hoi @ Foind warrant and Sonar!!
__________________
Bitte keine Fragen, zu Flash per PM. Dazu ist das Forum da. Danke MFG_RustyCake!
"Wer tanzen will, muß erst gehen lernen"
RustyCake ist offline   Mit Zitat antworten
Alt 23-02-2004, 19:40   #8 (permalink)
brand new user
 
Benutzerbild von RustyCake
 
Registriert seit: May 2002
Ort: Laimbach 6 1/2
Beiträge: 16.884
@ _geo_
habs jetzt mit nem MovieClip controler statt mit setinterval gebastelt, fängt auch ab 20 as spinnen an!!
__________________
Bitte keine Fragen, zu Flash per PM. Dazu ist das Forum da. Danke MFG_RustyCake!
"Wer tanzen will, muß erst gehen lernen"
RustyCake ist offline   Mit Zitat antworten
Alt 24-02-2004, 15:20   #9 (permalink)
brand new user
 
Benutzerbild von RustyCake
 
Registriert seit: May 2002
Ort: Laimbach 6 1/2
Beiträge: 16.884
So! update is fertig!!
ActionScript:
  1. hmenue_ary = ["section_1", "section_2", "section_3", "section_4", "section_5"];
  2. umenu_ary = [];
  3. umenu_ary[0] = ["sup_section 1_1", "sup_section 1_2", "sup_section 1_3"];
  4. umenu_ary[1] = ["sup_section 2_1", "sup_section 2_2", "sup_section 2_3", "sup_section 2_4", "sup_section 2_5"];
  5. umenu_ary[2] = ["sup_section 3_1", "sup_section 3_2", "sup_section 3_3", "sup_section 3_4"];
  6. umenu_ary[3] = ["sup_section 4_1", "sup_section 4_2"];
  7. umenu_ary[4] = ["sup_section 5_1", "sup_section 5_2", "sup_section 5_3", "sup_section 5_4"];
  8. var mp = 5;//<-- nur werte 1, 2, 4, 5, 10, 20 eingeben!! die button hoehe (btn_h=20) muß durch diesen wert teilbar sein!!
  9.                          //wenn die btn_h zb. 18 wäre könnte man 1, 2, 3, 6, 9 und 18 einstellen!!
  10. var xpos_hm = 60;
  11. var ypos_hm = 40;
  12. var btn_h = 20;
  13. hbtn_yo = [];
  14. hbtn_yn = [];
  15. ubtn_enco = [];
  16. hbtn_funk = [];
  17. ubtn_funk = [];
  18. sit = [];
  19. for (x=0; x<hmenue_ary.length; x++) {
  20.     ubtn_funk.push([]);
  21.     ubtn_enco.push([]);
  22. }
  23. for (i=0; i<hmenue_ary.length; i++) {
  24.     this.attachMovie("base_btn", "main_btn"+i, i+1000, {_x:xpos_hm, _y:btn_h*i+ypos_hm});
  25.     this["main_btn"+i].i = i;
  26.     hbtn_yo.push(ypos_hm+btn_h*i);
  27.     hbtn_funk.push(this["main_btn"+i]);
  28.     hbtn_funk[i].texter.text = hmenue_ary[i];
  29.     und_menu(i);
  30.     hbtn_funk[i].onPress = function() {
  31.         if (hbtn_mv != this._name) {
  32.             hbtn_mv = this._name;
  33.             mm_i = this.i;
  34.             um_i = ubtn_funk[mm_i];
  35.             if (count != 1) {
  36.                 move_out();
  37.                 count = 1;
  38.             } else {
  39.                 move_back();
  40.             }
  41.         }
  42.     };
  43. }
  44. this.createTextField("show_me", 200, 140, 100, 500, 200);
  45. tx = new TextFormat();
  46. tx.color = 0x999999;
  47. tx.size = 28;
  48. function und_menu(zw) {
  49.     zw_i = umenu_ary[zw];
  50.     for (i1=0; i1<zw_i.length; i1++) {
  51.         this.attachMovie("menue_btn", zw_i[i1], -i1-(20*zw), {_x:xpos_hm, _y:hbtn_yo[zw]});
  52.         ubtn_funk[zw].push(this[zw_i[i1]]);
  53.         ubtn_funk[zw][i1].texter1.text = zw_i[i1];
  54.         ubtn_enco[zw].push(hbtn_yo[zw]+btn_h*(i1+1));
  55.         ubtn_funk[zw][i1].onPress = function() {
  56.             this._parent.show_me.text = "hallo ich bin button "+this._name+" ;-)";
  57.             show_me.setTextFormat(tx);
  58.         };
  59.     }
  60. }
  61. for (y=0; y<hmenue_ary.length-1; y++) {
  62.     hbtn_yn.push([]);
  63.     mt = umenu_ary[y];
  64.     sit.push(mt.length);
  65.     for (y1=0; y1<hmenue_ary.length-1; y1++) {
  66.         hbtn_yn[y].push(btn_h*y1+(ypos_hm+btn_h));
  67.         hbtn_yn[y][y1] += (sit[y]*btn_h);
  68.     }
  69.     hbtn_yn[y].splice(0, y);
  70. }
  71. function move_out() {
  72.     for (f=(mm_i+1); f<hmenue_ary.length; f++) {
  73.         hbtn_funk[f].menue_move(hbtn_yn[mm_i][f-(mm_i+1)], mp);
  74.     }
  75.     for (g3=0; g3<um_i.length; g3++) {
  76.         um_i[g3].menue_move(ubtn_enco[mm_i][g3], mp);
  77.     }
  78. }
  79. function move_back() {
  80.     sID = setInterval(function () {
  81.         for (k=(mm_izw+1); k<hmenue_ary.length; k++) {
  82.             hbtn_funk[k].menue_move(hbtn_yo[k], mp);
  83.         }
  84.         for (g2=0; g2<um_izw.length; g2++) {
  85.             um_izw[g2].menue_move(hbtn_yo[mm_izw], mp);
  86.             if (um_izw[um_izw.length-1]._y<=hbtn_yo[mm_izw]) {
  87.                 move_out();
  88.                 clearInterval(sID);
  89.             }
  90.         }
  91.     }, 20);
  92. }
  93. MovieClip.prototype.menue_move = function(hmen_btny, hspeed) {
  94.     this.onEnterFrame = function() {
  95.         if (this._y<hmen_btny) {
  96.             this._y += hspeed;
  97.             mm_izw = mm_i;
  98.             um_izw = um_i;
  99.         } else if (this._y>hmen_btny) {
  100.             this._y -= hspeed;
  101.         } else {
  102.             delete this.onEnterFrame;
  103.         }
  104.     };
  105. };
Angehängte Dateien
Dateityp: zip new_dyn_menue.zip (5,5 KB, 290x aufgerufen)
__________________
Bitte keine Fragen, zu Flash per PM. Dazu ist das Forum da. Danke MFG_RustyCake!
"Wer tanzen will, muß erst gehen lernen"
RustyCake ist offline   Mit Zitat antworten
Alt 24-02-2004, 15:55   #10 (permalink)
Achim Math.PI
 
Benutzerbild von bloba
 
Registriert seit: Jul 2001
Ort: cool Colonia
Beiträge: 11.642
Thumbs up

sauber - geiles teil !


Hi5**Rusty
__________________
gruß bloba

2 x onkel² b_d
bloba ist offline   Mit Zitat antworten
Alt 24-02-2004, 15:57   #11 (permalink)
brand new user
 
Benutzerbild von RustyCake
 
Registriert seit: May 2002
Ort: Laimbach 6 1/2
Beiträge: 16.884
Hehe! Danke

Hi5**bloba
__________________
Bitte keine Fragen, zu Flash per PM. Dazu ist das Forum da. Danke MFG_RustyCake!
"Wer tanzen will, muß erst gehen lernen"
RustyCake ist offline   Mit Zitat antworten
Alt 24-02-2004, 16:06   #12 (permalink)
~~~~~~~~~~~~
 
Benutzerbild von _geo_
 
Registriert seit: May 2002
Ort: AUSTRIA (OÖ)
Beiträge: 3.298
Thumbs up

goil !

rusty said: " fängt auch ab 20 as spinnen an!! "

@rusty: ab 20 siehst eh nix mehr
__________________
--- :P ---

Blog
Bei unerwünschten Nebenwirkungen zerreißen Sie die Packungsbeilage oder erschlagen ihren Arzt oder Apotheker
_geo_ ist offline   Mit Zitat antworten
Alt 24-02-2004, 16:10   #13 (permalink)
Steffen G.
 
Benutzerbild von Tschdaeff
 
Registriert seit: Aug 2001
Ort: Ba-Wü
Beiträge: 4.123
was passiert wenn man bei nem menüpunkt mal kein untermenü hat?


servus zusammen


cu mfg
Tschdaeff
__________________
mod@
www.flashbattle.de
www.steffen-guse.de
------------------------------------

Tschdaeff ist offline   Mit Zitat antworten
Alt 24-02-2004, 16:14   #14 (permalink)
Achim Math.PI
 
Benutzerbild von bloba
 
Registriert seit: Jul 2001
Ort: cool Colonia
Beiträge: 11.642
Zitat:
Geschrieben von Tschdaeff
was passiert wenn man bei nem menüpunkt mal kein untermenü hat?


servus zusammen


cu mfg
Tschdaeff
dann geths einfach ned auf
__________________
gruß bloba

2 x onkel² b_d
bloba ist offline   Mit Zitat antworten
Alt 24-02-2004, 16:15   #15 (permalink)
brand new user
 
Benutzerbild von RustyCake
 
Registriert seit: May 2002
Ort: Laimbach 6 1/2
Beiträge: 16.884
Hhhm! Gute Frage
dann hats kein untermenue
__________________
Bitte keine Fragen, zu Flash per PM. Dazu ist das Forum da. Danke MFG_RustyCake!
"Wer tanzen will, muß erst gehen lernen"
RustyCake 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 08:32 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele