Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 01-12-2004, 21:52   #1 (permalink)
man lernt immer dazu
 
Benutzerbild von dabinjo
 
Registriert seit: Dec 2003
Ort: Freiburg
Beiträge: 442
zusammenfassen

Schönen Abend zusammen

Wenn das mal jemand anschauen will, denn vielleicht kann mir jemand einen Tip geben wie ich das Script in eleganterer Weise schreiben kann.
Habs leider nur so hinbekommen.


ActionScript:
  1. balken.tween('_x', 300, 1, 'easeoutelastic', 0);
  2. balken.alphaTo(0, 0);
  3. balken1.tween('_x', 300, 1, 'easeoutelastic', 0);
  4. balken1.alphaTo(0, 0);
  5. balken2.tween('_x', 300, 1, 'easeoutelastic', 0);
  6. balken2.alphaTo(0, 0);
  7. balken3.tween('_x', 300, 1, 'easeoutelastic', 0);
  8. balken3.alphaTo(0, 0);
  9. balken4.tween('_x', 300, 1, 'easeoutelastic', 0);
  10. balken4.alphaTo(0, 0);
  11. balken5.tween('_x', 300, 1, 'easeoutelastic', 0);
  12. balken5.alphaTo(0, 0);
  13.  
  14. button1.onRollOver = function() {
  15.     balken.tween('_x', 440, 0.2, 'easeoutQuad', 0);
  16.     balken.alphaTo(70, 1);
  17. };
  18. button1.onRollOut = function() {
  19.     balken.tween('_x',300, 2, 'easeout', 0);
  20.     balken.alphaTo(0, 2);
  21. };
  22. button2.onRollOver = function() {
  23.     balken1.tween('_x', 440, 0.2, 'easeoutQuad', 0);
  24.     balken1.alphaTo(70, 1);
  25. };
  26. button2.onRollOut = function() {
  27.     balken1.tween('_x',300, 2, 'easeout', 0);
  28.     balken1.alphaTo(0, 2);
  29. };
  30. button3.onRollOver = function() {
  31.     balken2.tween('_x', 4400.2, 'easeoutQuad', 0);
  32.     balken2.alphaTo(70, 1);
  33. };
  34. button3.onRollOut = function() {
  35.     balken2.tween('_x',300,2, 'easeout', 0);
  36.     balken2.alphaTo(0, 2);
  37. };
  38. button4.onRollOver = function() {
  39.     balken3.tween('_x', 440, 0.2 , 'easeoutQuad', 0);
  40.     balken3.alphaTo(70, 1);
  41. };
  42. button4.onRollOut = function() {
  43.     balken3.tween('_x',3002, 'easeout', 0);
  44.     balken3.alphaTo(0, 2);
  45. };
  46. button5.onRollOver = function() {
  47.     balken4.tween('_x', 440, 0.2, 'easeoutQuad', 0);
  48.     balken4.alphaTo(70, 1);
  49. };
  50. button5.onRollOut = function() {
  51.     balken4.tween('_x',300,2, 'easeout', 0);
  52.     balken4.alphaTo(0, 2);
  53. };

danke und gute nacht
dabinjo ist offline   Mit Zitat antworten
Alt 01-12-2004, 22:01   #2 (permalink)
Definitionssache
 
Benutzerbild von dburucu
 
Registriert seit: Apr 2003
Ort: Braunschweig
Beiträge: 2.433
1. benenne dein "balken" in "balken0", überall wo du das hast.
2.
ActionScript:
  1. for (i=0;i<=5;i++)
  2. {
  3. _root['balken'+i].tween('_x', 300, 1, 'easeoutelastic', 0);
  4. _root['balken'+i].alphaTo(0, 0);
  5. _root['balken'+i].i = i;
  6. if (i>0)
  7. {
  8. _root['balken'+i].onRollOver = function() {
  9.     _root['balken'+(this.i-1)].tween('_x', 440, 0.2, 'easeoutQuad', 0);
  10.     _root['balken'+(this.i-1)].alphaTo(70, 1);
  11. };
  12. _root['balken'+i].onRollOut = function() {
  13.     _root['balken'+(this.i-1)].tween('_x',300, 2, 'easeout', 0);
  14.     _root['balken'+(this.i-1)].alphaTo(0, 2);
  15. };
  16. }
  17. }

habs nicht probiert, aber sollte gehen.
dburucu ist offline   Mit Zitat antworten
Alt 01-12-2004, 22:23   #3 (permalink)
man lernt immer dazu
 
Benutzerbild von dabinjo
 
Registriert seit: Dec 2003
Ort: Freiburg
Beiträge: 442
hmmm...kannst du mir das erläutern? Ich habe es mal verwendet aber es funktioniert nicht.
dabinjo ist offline   Mit Zitat antworten
Alt 01-12-2004, 22:41   #4 (permalink)
Definitionssache
 
Benutzerbild von dburucu
 
Registriert seit: Apr 2003
Ort: Braunschweig
Beiträge: 2.433
ActionScript:
  1. for (i=0;i<=5;i++) //mach von 0 bis 5 folgendes
  2. {
  3. // mit _root['balken'+i] wird jedes einzelne MC angesprochen.
  4. // für i=0 ist _root['balken'+i] = _root['balken0'] = balken0
  5. // für i=1 ist _root['balken'+i] = _root['balken1'] = balken1
  6. // für i=2 ist _root['balken'+i] = _root['balken2'] = balken2
  7. _root['balken'+i].tween('_x', 300, 1, 'easeoutelastic', 0);
  8. _root['balken'+i].alphaTo(0, 0);
  9.  
  10. // das brauchen wir, damit wir das i auch in den beiden unteren Funktionen wieder benutzen zu können.
  11. _root['balken'+i].i = i;
  12. if (i>0)
  13. {
  14. _root['balken'+i].onRollOver = function() {
  15.     // wenn i = 1 ist, ist this.i = 1, _root['balken'+(this.i-1)] = _root['balken'+(1-1)] = _root['balken'+0] = _root['balken0'] = balken0
  16.     _root['balken'+(this.i-1)].tween('_x', 440, 0.2, 'easeoutQuad', 0);
  17.     _root['balken'+(this.i-1)].alphaTo(70, 1);
  18. };
  19. _root['balken'+i].onRollOut = function() {
  20.     _root['balken'+(this.i-1)].tween('_x',300, 2, 'easeout', 0);
  21.     _root['balken'+(this.i-1)].alphaTo(0, 2);
  22. };
  23. }
  24. }
dburucu ist offline   Mit Zitat antworten
Alt 02-12-2004, 09:22   #5 (permalink)
man lernt immer dazu
 
Benutzerbild von dabinjo
 
Registriert seit: Dec 2003
Ort: Freiburg
Beiträge: 442
ich schätze mal du hast die onRollOver aktionen versehentlich auf die balken instanz gelegt...
dabinjo ist offline   Mit Zitat antworten
Alt 02-12-2004, 09:25   #6 (permalink)
Definitionssache
 
Benutzerbild von dburucu
 
Registriert seit: Apr 2003
Ort: Braunschweig
Beiträge: 2.433
hmm eigentlich so wie bei dir oben...

poste mal dein fla, wenns geht.
dburucu ist offline   Mit Zitat antworten
Alt 02-12-2004, 09:34   #7 (permalink)
man lernt immer dazu
 
Benutzerbild von dabinjo
 
Registriert seit: Dec 2003
Ort: Freiburg
Beiträge: 442
ich habe oben die mcs mit dem namen button als aktionsfläche benutzt , die onrollover die balken instanz tweenen. die fla muss ich erst ausseinander klamüstern weil dieses script vergraben liegt...aber ich versuchs mal
dabinjo ist offline   Mit Zitat antworten
Alt 02-12-2004, 09:54   #8 (permalink)
Definitionssache
 
Benutzerbild von dburucu
 
Registriert seit: Apr 2003
Ort: Braunschweig
Beiträge: 2.433
*putzt seine Augen* ehm wo?
dburucu ist offline   Mit Zitat antworten
Alt 02-12-2004, 10:00   #9 (permalink)
man lernt immer dazu
 
Benutzerbild von dabinjo
 
Registriert seit: Dec 2003
Ort: Freiburg
Beiträge: 442
die fla und zip sind zu gross um zu posten...sorry. aber vielleicht schaf fe ich es auch noch so...warte:

meine aktion

button1.onRollOver = function() {
****balken.tween('_x', 440, 0.2, 'easeoutQuad', 0);
****balken.alphaTo(70, 1);


deine aktion

_root['balken'+i].onRollOver = function() {
****_root['balken'+(this.i-1)].tween('_x', 440, 0.2, 'easeoutQuad', 0);
****_root['balken'+(this.i-1)].alphaTo(70, 1);


siehst du was ich meine?? du benutzt den balken als schaltfläche ich den button
dabinjo ist offline   Mit Zitat antworten
Alt 02-12-2004, 10:08   #10 (permalink)
Definitionssache
 
Benutzerbild von dburucu
 
Registriert seit: Apr 2003
Ort: Braunschweig
Beiträge: 2.433
ahhhhhh

ok

das Augenputzen hat geholfen.

also so:

ActionScript:
  1. for (i=0;i<=5;i++) //mach von 0 bis 5 folgendes
  2. {
  3. // mit _root['balken'+i] wird jedes einzelne MC angesprochen.
  4. // für i=0 ist _root['balken'+i] = _root['balken0'] = balken0
  5. // für i=1 ist _root['balken'+i] = _root['balken1'] = balken1
  6. // für i=2 ist _root['balken'+i] = _root['balken2'] = balken2
  7. _root['balken'+i].tween('_x', 300, 1, 'easeoutelastic', 0);
  8. _root['balken'+i].alphaTo(0, 0);
  9.  
  10. // das brauchen wir, damit wir das i auch in den beiden unteren Funktionen wieder benutzen zu können.
  11. _root['balken'+i].i = i;
  12. if (i>0)
  13. {
  14. _root['button'+i].onRollOver = function() {
  15.     // wenn i = 1 ist, ist this.i = 1, _root['balken'+(this.i-1)] = _root['balken'+(1-1)] = _root['balken'+0] = _root['balken0'] = balken0
  16.     _root['balken'+(this.i-1)].tween('_x', 440, 0.2, 'easeoutQuad', 0);
  17.     _root['balken'+(this.i-1)].alphaTo(70, 1);
  18. };
  19. _root['button'+i].onRollOut = function() {
  20.     _root['balken'+(this.i-1)].tween('_x',300, 2, 'easeout', 0);
  21.     _root['balken'+(this.i-1)].alphaTo(0, 2);
  22. };
  23. }
  24. }
dburucu 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 12:17 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele