Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 03-08-2003, 13:24   #1 (permalink)
AS-lehrling
 
Registriert seit: Jul 2001
Ort: Berlin
Beiträge: 614
navi überlappt sich

sers leutz

also schaut euch ma

http://junkz.users.go2host.de/naviaua.html

an

wie ihr mitkriegen werdet, wenn man da an der navi bisl rum spielt überlappen sich die einzelnen navigationsbalken schon einige male

das will ich verhindern

frage nur wie

wenn irh selber dafür eine idee habt sagt sie ruhig

ich erzähl euch ersma meine

ich wollte nun functionen schreiben, das sich die x koordinaten bei den anderen balken so anpassen, das sie sich nicht überlappen beim rollover oder out

an sich nich das grosse problem

das einfach das sich der erste balken an den zweiten richtet, der zeeitwe an den ersten und dritten etc etc

hierbei ist aber das problem, das indem balken mc noch ein mc steckt

also eine mc verschachtelung

das dient dafür das ich somit den mittelpunkt halt verändern kann für die skalierung der balken

und wenn sich das nun skaliert dann änder sich ja nich die x koordinate....und da steckt mein priblem

ich weiss einfach nich welches script ic schreiben könnte, das die balken immer dne gleichen abstand voneinander haben

könnt ihr mir da helfen? .. ich überleg scho seid zwei tagen aber ne richtige lösung fällt mir nich ein

ode rhabt ihr eine andere idee für das überlappungsproblem?

wenn es euch was bringen sollte, ich häng mal die prototypen rein womit die balken animiert werden

ActionScript:
  1. // die aufrufe
  2.  
  3. wnews.onRollOver = function() {
  4.     _root.wnews.balken1(159, 0);
  5.    
  6. };
  7. wnews.onRollOut = function() {
  8.     _root.wnews.balkenu(159, 100, 0);
  9.     };
  10. wabout.onRollOver = function() {
  11.     _root.wabout.balken1(433, 1);
  12.     };
  13. wabout.onRollOut = function() {
  14.     _root.wabout.balkenu(433, 100, 1);
  15.    
  16. };
  17. wstaring.onRollOver = function() {
  18.     _root.wstaring.balken1(300, 2);
  19.     };
  20. wstaring.onRollOut = function() {
  21.     _root.wstaring.balkenu(300, 100, 2);
  22.     };
  23. wmatches.onRollOver = function() {
  24.     _root.wmatches.balken1(267, 3);
  25.     };
  26. wmatches.onRollOut = function() {
  27.     _root.wmatches.balkenu(267, 100, 3);
  28.     };
  29. wgbook.onRollOver = function() {
  30.     _root.wgbook.balken1(350, 4);
  31.    
  32. };
  33. wgbook.onRollOut = function() {
  34.     _root.wgbook.balkenu(350, 100, 4);
  35.     };
  36.  
  37. //nun die prototypen
  38.  
  39. menu = new Array(5);
  40. menu[0] = false;
  41. menu[1] = false;
  42. menu[2] = false;
  43. menu[3] = false;
  44. menu[4] = false;
  45. _root.createEmptyMovieClip('container', 1);
  46.  
  47. MovieClip.prototype.balken1 = function(ziel, index) {
  48.     ende = 0;
  49.     this.onEnterFrame = function() {
  50.         this._xscale += (-this._xscale+ziel)*.4;
  51.         if (this._xscale>=(ziel-1)) {
  52.             this._xscale = ziel;
  53.             delete this.onEnterFrame;
  54.             trace("delete balken 1");
  55.         }
  56.     };
  57. };
  58. //erster proto für die skalierung bei dem rollover
  59.  
  60. MovieClip.prototype.balkenu = function(ziel, ziel2, index) {
  61.     if (this._xscale<ziel-1) {
  62.         this.balken3(ziel, ziel2, index);
  63.         trace(" zu balken3 von nu");
  64.     } else if (this._xscale>=ziel-1) {
  65.         this.balken2(ziel2, index);
  66.         trace(" zu balken2 von nu");
  67.     }
  68. };
  69. //überprüfung ob fertig skaliert wurde vor dem rollout, wenn ja gehe zu balken 2, wenn nicht gehe zu balken 3
  70.  
  71. MovieClip.prototype.balken3 = function(ziel, ziel2, index) {
  72.     this.onEnterFrame = function() {
  73.         this._xscale += (-this._xscale+ziel)*.4;
  74.         if (this._xscale>=ziel-1) {
  75.             this._xscale = ziel;
  76.             this.balkenu(ziel, ziel2, index);
  77.         }
  78.     };
  79. };
  80.  
  81. /skaliere fertig, wenn fertig gehe nochmal zur überprüfung
  82.  
  83. _root.container.balken3(zie, ziel2, index);
  84.  
  85. MovieClip.prototype.balken2 = function(ziel2, index) {
  86.     if (menu[index] == 0) {
  87.         this.skali1(index);
  88.     } else {
  89.         this.skali2(index);
  90.     }
  91.  
  92. //wechsel den mittelpunkt durch die verschachtelung
  93.  
  94.     this.onEnterFrame = function() {
  95.         this._xscale += (-this._xscale+ziel2)*.4;
  96.         if (this._xscale<=ziel2+1) {
  97.             this._xscale = ziel2;
  98.             delete this.onEnterFrame;
  99.             trace("delete balken 2");
  100.             delete _root.container.onEnterFrame;
  101.         }
  102.     };
  103. };
  104.  
  105. //gegenskalierung
  106.  
  107. MovieClip.prototype.skali1 = function(index) {
  108.     this.inn._x = this.inn._width+this.inn._x;
  109.     this._x = this._x-this._width;
  110.     menu[index] = 1;
  111.     trace("menu1");
  112. };
  113. MovieClip.prototype.skali2 = function(index) {
  114.     this.inn._x = this.inn._x-this.inn._width;
  115.     this._x = this._x+this._width;
  116.     menu[index] = 0;
  117.     trace("menu0");
  118. };
  119.  
  120.  
  121. //script für den mittelpunkt wechsel zum links skalieren und rechtsskalieren
  122.  

wie gesagt das script halt nur falls ihr es braucht...da funktioniert soweit auch alles

mein problem is das mti dem überlappen und das mit dem abstand

hoffe ihr könnt mir helfen :/

thx

mfg

Geändert von vato (03-08-2003 um 13:25 Uhr)
vato ist offline   Mit Zitat antworten
Alt 04-08-2003, 16:20   #2 (permalink)
Steffen G.
 
Benutzerbild von Tschdaeff
 
Registriert seit: Aug 2001
Ort: Ba-Wü
Beiträge: 4.123
hab dir mal was gemacht ist nicht genau das selbe geht aber in die richtung

ActionScript:
  1. hoehe = 7
  2. function back () {
  3.     for (var i=1;i<=5;i++) {
  4.         _root["men"+i]._height = hoehe
  5.         _root["men"+i]._y = 100+i*(hoehe+1)
  6.     }
  7. }
  8. backset = setInterval (back,20)
  9.        
  10. for (var i=1;i<=5;i++) {
  11.     _root["men"+i]._y = 100+i*(hoehe+1)
  12.     _root["men"+i]._height = hoehe
  13.     _root["men"+i].id = i
  14.     _root["men"+i].ypos = _root["men"+i]._y
  15.     _root["men"+i].onRollOver = function () {
  16.         clearInterval (backset)
  17.         this.onEnterFrame = function () {
  18.             this.ausfade (14,2,this.id,11)
  19.         }
  20.     }
  21.     _root["men"+i].onRollOut = function () {
  22.         backset = setInterval (back,20)
  23.         this.onEnterFrame = function () {
  24.             this.ausfade (hoehe,2,this.id,0)
  25.         }
  26.     }
  27. }
  28. movieclip.prototype.ausfade = function (maxh,fakt,id,abst) {
  29.     for (var i=0;i<id;i++) {
  30.         _root["men"+i].onEnterFrame = function () {
  31.             this.yfade (this.ypos-abst,2)
  32.         }
  33.     }
  34.     for (var j=1;j<=5;j++) {
  35.         if (_root["men"+j]._height == hoehe)  {
  36.             this.dif = maxh-this._height
  37.             if (Math.round(this.dif)==0) {
  38.             delete this.onEnterFrame;
  39.             }
  40.     this._height += this.dif/fakt
  41.         }
  42.     }
  43. }
  44. movieclip.prototype.yfade = function (ypos,fakt) {
  45.     this.ydif = ypos-this._y
  46.     this._y += this.ydif/fakt
  47.     if (Math.round(this.ydif)==0) {
  48.         delete this.onEnterFrame;
  49.     }
  50. }

cu mfg
Tschdaeff
Angehängte Dateien
Dateityp: zip navitestv2.zip (2,7 KB, 13x aufgerufen)
__________________
mod@
www.flashbattle.de
www.steffen-guse.de
------------------------------------

Tschdaeff ist offline   Mit Zitat antworten
Alt 04-08-2003, 16:48   #3 (permalink)
AS-lehrling
 
Registriert seit: Jul 2001
Ort: Berlin
Beiträge: 614
wuha...nich klein^^

dickes danke tschdaeff (:

werd miche rsma versuchen da durchzuknobeln..wenn ich fragen hab meld ich mich eh wieda

dank dir nochma (:

thx

mfg
vato ist offline   Mit Zitat antworten
Alt 04-08-2003, 17:25   #4 (permalink)
Steffen G.
 
Benutzerbild von Tschdaeff
 
Registriert seit: Aug 2001
Ort: Ba-Wü
Beiträge: 4.123
jo kein prob wenns fragen dazu gibt einfach wieder melden

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

Tschdaeff ist offline   Mit Zitat antworten
Alt 07-08-2003, 02:06   #5 (permalink)
AS-lehrling
 
Registriert seit: Jul 2001
Ort: Berlin
Beiträge: 614
doch noch was (:

sers .. also ich blick das janze soweit schon ..... nur hab ich eine frage

ActionScript:
  1. movieclip.prototype.ausfade = function (maxh,fakt,id,abst) {
  2.         for (var i=0;i<id;i++) {
  3.                 _root["men"+i].onEnterFrame = function () {
  4.                         this.yfade (this.ypos-abst,2)
  5.                 }
  6.         }

hier die parameterübergabe

ActionScript:
  1. this.yfade (this.ypos-abst,2)

was is das für eine übergabe?

also was ist das abst? wo wird das definiert?


ja wie gesagt .... ich denke das ich das script an sich schon vertsanden hab, jedoch kann ich in mein kopf nich soeit umdenken um das auf mein script umzustruktuieren :/

thx

mfg

Geändert von vato (07-08-2003 um 02:15 Uhr)
vato ist offline   Mit Zitat antworten
Alt 07-08-2003, 02:32   #6 (permalink)
_______________
 
Benutzerbild von son yu
 
Registriert seit: Mar 2003
Ort: !Schnitzerland
Beiträge: 2.003
also soweit ich das überblicke wird abst nicht direkt definiert...

versuch der kommentierung...
ActionScript:
  1. hoehe = 7
  2. function back () {
  3.     for (var i=1;i<=5;i++) {
  4.         _root["men"+i]._height = hoehe
  5.         _root["men"+i]._y = 100+i*(hoehe+1)
  6.     }
  7. }
  8. backset = setInterval (back,20)
  9.        
  10. for (var i=1;i<=5;i++) {
  11.     _root["men"+i]._y = 100+i*(hoehe+1)
  12.     _root["men"+i]._height = hoehe
  13.     _root["men"+i].id = i
  14.     _root["men"+i].ypos = _root["men"+i]._y
  15.     _root["men"+i].onRollOver = function () {
  16.         clearInterval (backset)
  17.         this.onEnterFrame = function () {
  18.             this.ausfade (14,2,this.id,11)// hier wird abst mit dem wert 11 an ausfade übergeben
  19.         }
  20.     }
  21.     _root["men"+i].onRollOut = function () {
  22.         backset = setInterval (back,20)
  23.         this.onEnterFrame = function () {
  24.             this.ausfade (hoehe,2,this.id,0)//hier wird abst mit dem wert o an ausfade übergeben
  25.         }
  26.     }
  27. }
  28. movieclip.prototype.ausfade = function (maxh,fakt,id,abst) {
  29.     for (var i=0;i<id;i++) {
  30.         _root["men"+i].onEnterFrame = function () {
  31.             this.yfade (this.ypos-abst,2)// hier wird abst vom aktuellen button abgezogen, siehst du am spalt zwischen den menüs
  32.         }
  33.     }
  34.     for (var j=1;j<=5;j++) {
  35.         if (_root["men"+j]._height == hoehe)  {
  36.             this.dif = maxh-this._height
  37.             if (Math.round(this.dif)==0) {
  38.             delete this.onEnterFrame;
  39.             }
  40.     this._height += this.dif/fakt
  41.         }
  42.     }
  43. }
  44. movieclip.prototype.yfade = function (ypos,fakt) {
  45.     this.ydif = ypos-this._y
  46.     this._y += this.ydif/fakt
  47.     if (Math.round(this.ydif)==0) {
  48.         delete this.onEnterFrame;
  49.     }
  50. }

die variable abst enthält sozusagen nur den momentanen abstand des mc, auf dessen du dich befindest, zu den übrigen

schöne grüße
__________________
ey… be cool!

Mac OS-X 10.5.6, Safari Version 4 Public Beta (5528.16), on PowerBook 12" G4 1,5 GHz,
1,25 GB RAM, FlashPlayer 9 is auch noch da, wenn ich Lust habe…
son yu ist offline   Mit Zitat antworten
Alt 07-08-2003, 02:46   #7 (permalink)
AS-lehrling
 
Registriert seit: Jul 2001
Ort: Berlin
Beiträge: 614
jo so hab ich mir das auch scho gedacht..wollte nur nochma sicha gehen (:

dangö
vato ist offline   Mit Zitat antworten
Alt 07-08-2003, 03:01   #8 (permalink)
_______________
 
Benutzerbild von son yu
 
Registriert seit: Mar 2003
Ort: !Schnitzerland
Beiträge: 2.003
na denn,

geh ich mir lieber mal die matratze suchen...

schöne grüße und gut nacht
__________________
ey… be cool!

Mac OS-X 10.5.6, Safari Version 4 Public Beta (5528.16), on PowerBook 12" G4 1,5 GHz,
1,25 GB RAM, FlashPlayer 9 is auch noch da, wenn ich Lust habe…
son yu ist offline   Mit Zitat antworten
Alt 07-08-2003, 03:09   #9 (permalink)
AS-lehrling
 
Registriert seit: Jul 2001
Ort: Berlin
Beiträge: 614
undich kireg das tortzdem nich gebacken^^

ich schaff das irgwendwie mit dem aufrufen nich ... würde zwa wohl ein bisschen viel verlangt sein , aber ich weiss mir da nich grossaertig anders zu helfen .. ich häng mal die fla an, die halt noch ohne dem versuchten script is ... kann man ja evtl da probieren das ganze anzuwenden :/

hier die file http://junkz.users.go2host.de/naviaua.rar

thx

mfg
vato ist offline   Mit Zitat antworten
Alt 11-08-2003, 17:56   #10 (permalink)
AS-lehrling
 
Registriert seit: Jul 2001
Ort: Berlin
Beiträge: 614
udn das nächste kapitel

sers volkz

also weil ich kein doppelpost machen möchte, post ich das nun hier nochmal rein und hoffe es kann weiterbehandelt werden

was ich machen will steht oben

habe da nun über ne woche probiert und krieg das einfach nich gebacken

habe dann folgendes gebastelt

ActionScript:
  1. //aufrufe
  2.  
  3. balk0.onRollOver = function() {
  4.     _root.balk0.balken1(159, 0);
  5.     _root.tnews.text1();
  6. };
  7. balk0.onRollOut = function() {
  8.     _root.balk0.balkenu(159, 100, 0);
  9.     _root.tnews.text2();
  10. };
  11. balk1.onRollOver = function() {
  12.     _root.balk1.balken1(433, 1);
  13.     _root.tabout.text1();
  14. };
  15. balk1.onRollOut = function() {
  16.     _root.balk1.balkenu(433, 100, 1);
  17.     _root.tabout.text2();
  18. };
  19. balk2.onRollOver = function() {
  20.     _root.balk2.balken1(300, 2);
  21.     _root.tstaring.text1();
  22. };
  23. balk2.onRollOut = function() {
  24.     _root.balk2.balkenu(300, 100, 2);
  25.     _root.tstaring.text2();
  26. };
  27. balk3.onRollOver = function() {
  28.     _root.balk3.balken1(267, 3);
  29.     _root.tmatches.text1();
  30. };
  31. balk3.onRollOut = function() {
  32.     _root.balk3.balkenu(267, 100, 3);
  33.     _root.tmatches.text2();
  34. };
  35. balk4.onRollOver = function() {
  36.     _root.balk4.balken1(350, 4);
  37.     _root.tgbook.text1();
  38. };
  39. balk4.onRollOut = function() {
  40.     _root.balk4.balkenu(350, 100, 4);
  41.     _root.tgbook.text2();
  42. };
  43.  
  44. //nun die prototypen
  45.  
  46. menu = new Array(5);
  47. _root.menu[0] = false;
  48. _root.menu[1] = false;
  49. _root.menu[2] = false;
  50. _root.menu[3] = false;
  51. _root.menu[4] = false;
  52.  
  53.  
  54. _root.createEmptyMovieClip('container', 1);
  55.  
  56. //erster proto für die skalierung bei dem rollover
  57.  
  58. MovieClip.prototype.balken1 = function(ziel, index) {
  59.     if (_root.menu[index] == 0) {
  60.         this.welche1(index, index);
  61.     } else {
  62.         this.welche3(index, index);
  63.     }
  64.     this.onEnterFrame = function() {
  65.         this._xscale += (-this._xscale+ziel)*.4;
  66.         if (this._xscale>=(ziel-1)) {
  67.             this._xscale = ziel;
  68.             delete this.onEnterFrame;
  69.             trace("delete balken 1");
  70.         }
  71.     };
  72. };
  73. MovieClip.prototype.balkenu = function(ziel, ziel2, index) {
  74.     if (this._xscale<ziel-1) {
  75.         this.balken3(ziel, ziel2, index);
  76.         trace(" zu balken3 von nu");
  77.     } else if (this._xscale>=ziel-1) {
  78.         this.balken2(ziel2, index);
  79.         trace(" zu balken2 von nu");
  80.     }
  81. };
  82.  
  83. //überprüfung ob fertig skaliert wurde vor dem rollout, wenn ja gehe zu balken 2, wenn nicht gehe zu balken 3
  84.  
  85. MovieClip.prototype.balken3 = function(ziel, ziel2, index) {
  86.     this.onEnterFrame = function() {
  87.         this._xscale += (-this._xscale+ziel)*.4;
  88.         if (this._xscale>=ziel-1) {
  89.             this._xscale = ziel;
  90.             this.balkenu(ziel, ziel2, index);
  91.         }
  92.     };
  93. };
  94. _root.container.balken3(zie, ziel2, index);
  95. MovieClip.prototype.balken2 = function(ziel2, index) {
  96.     if (_root.menu[index] == 0) {
  97.         this.skali1(index);
  98.         this.welche2(index, index);
  99.     } else {
  100.         this.skali2(index);
  101.         this.welche4(index, index);
  102.     }
  103.  
  104. //wechsel den mittelpunkt durch die verschachtelung
  105.  
  106.     this.onEnterFrame = function() {
  107.         this._xscale += (-this._xscale+ziel2)*.4;
  108.         if (this._xscale<=ziel2+1) {
  109.             this._xscale = ziel2;
  110.             delete this.onEnterFrame;
  111.             trace("delete balken 2");
  112.             count = 1;
  113.             delete _root.container.onEnterFrame;
  114.         }
  115.     };
  116. };
  117.  
  118. //überprüfe welche mcs bewegt werden müssen
  119.  
  120. MovieClip.prototype.welche1 = function(id, index) {
  121.     for (var i = 0; i<id; i++) {
  122.         _root["balk"+i].xpos = _root["balk"+i]._x;
  123.         trace(_root["balk"+i].xpos);
  124.        
  125.         _root["balk"+i].onEnterFrame = function() {
  126.             this.bla(this.xpos);
  127.         };
  128.     }
  129. };
  130. MovieClip.prototype.welche2 = function(id, index) {
  131.     if (count == 1) {
  132.         for (var i = id+1; i<6; i++) {
  133.             _root["balk"+i].xpos = _root["balk"+i]._x;
  134.             trace(_root["balk"+i].xpos);
  135.             _root["balk"+i].onEnterFrame = function() {
  136.                 this.bla(this.xpos, 4);
  137.             };
  138.         }
  139.     }
  140. };
  141. MovieClip.prototype.welche3 = function(id, index) {
  142.     if (count == 1) {
  143.         for (var i = id+1; i<6; i++) {
  144.             _root["balk"+i].xpos = _root["balk"+i]._x;
  145.             trace(_root["balk"+i].xpos);
  146.            
  147.             _root["balk"+i].onEnterFrame = function() {
  148.                 this.bla2(this.xpos);
  149.             };
  150.         }
  151.     }
  152. };
  153. MovieClip.prototype.welche4 = function(id, index) {
  154.     for (var i = 0; i<id; i++) {
  155.         _root["balk"+i].xpos = _root["balk"+i]._x;
  156.         trace(_root["balk"+i].xpos);
  157.         _root["balk"+i].onEnterFrame = function() {
  158.             this.bla2(this.xpos, 1);
  159.         };
  160.     }
  161. };
  162.  
  163. //mcs um den angewählten mc bewegen
  164.  
  165. MovieClip.prototype.bla = function(kmh) {
  166.     this._x += (-this._x+this.xpos-10)*.1;
  167. };
  168. MovieClip.prototype.bla2 = function(kmh) {
  169.     this._x += (-this._x+this.xpos+10)*.1;
  170. };
  171.  
  172. //gegenskalierung
  173.  
  174. MovieClip.prototype.skali1 = function(index) {
  175.     this.inn._x = this.inn._width+this.inn._x;
  176.     this._x = this._x-this._width;
  177.     _root.menu[index] = 1;
  178.     trace("menu1");
  179. };
  180. MovieClip.prototype.skali2 = function(index) {
  181.     this.inn._x = this.inn._x-this.inn._width;
  182.     this._x = this._x+this._width;
  183.     _root.menu[index] = 0;
  184.     trace("menu0");
  185. };
  186.  
  187. //script für den mittelpunkt wechsel zum links skalieren und rechtsskalieren
  188.  

so dazu nochmal die swf

http://junkz.users.go2host.de/naviversuch5.swf

also soweit funzt auch alles

jedoch will ich das ganze so, das sich die balken aneinander orientieren

denn wenn ich zb zu schnell rüber gehe über die balken, dann sollen sie sich nich weiter bewegen sondern den gleichen abstand zu den balken haben wie immer

naja also ich hab da sncih hinbekommen....die versuche wollt ihr erst garnicht sehen :/

weisst da einer von euch weiter?

falls es hilft häng ich nochma die fla ran

thx

mfg
Angehängte Dateien
Dateityp: rar naviversuch5.rar (2,3 KB, 3x aufgerufen)
vato 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 01:23 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele