Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 22-10-2004, 10:18   #1 (permalink)
Neuer User
 
Registriert seit: Sep 2003
Ort: MC-Pomm
Beiträge: 87
script optimierung bildgalerie

hallo an alle,

wie kann man das hier noch optimieren?

//bildhintergrund zurücksetzen
square._alpha = 0;
//bild 1 laden
_root.b1.onPress = function() {
bild = 1;
if ( !fadeIn && !fadeOut) {
fadeOut = true;
}
};
//bild 2 laden
_root.b2.onPress = function() {
bild = 2;
if ( !fadeIn && !fadeOut) {
fadeOut = true;
}
};
//Bild 4 laden
_root.b4.onPress = function() {
bild = 4;
if ( !fadeIn && !fadeOut) {
fadeOut = true;
}
};
//Bild 3 laden
_root.b3.onPress = function() {
bild = 3;
if ( !fadeIn && !fadeOut) {
fadeOut = true;
}
};
//Bild 11 ladem
_root.b11.onPress = function() {
bild = 11;
if ( !fadeIn && !fadeOut) {
fadeOut = true;
}
};

_root.onEnterFrame = function() {
// when a new Photo is selected, fade out, load new image, and fade in
if (square._alpha>10 && fadeOut) {
square._alpha -= 10;
}
if (square._alpha<10) {
loadMovie("C:/Programme/Macromedia/Flash MX/Samples/SWF/image"+bild+".jpg", "_root.square");
fadeOut = false;
fadeIn = true;
}
if (square._alpha<100 && fadeIn && !fadeOut) {
square._alpha += 10;
} else {
fadeIn = false;
}
// limit input field
if (input>5) {
input = 5;
}
// initiate change to new image when Enter key is pressed
if (Key.isDown(Key.ENTER)) {
fadeOut = true;
whichpic = input;
}
};

falls mal einer sehen will http://home.media-n.de/11817/aquatest1.swf

mfg torsten

Geändert von totty38 (22-10-2004 um 10:24 Uhr) Grund: neuer titel
totty38 ist offline   Mit Zitat antworten
Alt 22-10-2004, 10:30   #2 (permalink)
mod_rewrite
 
Benutzerbild von sonar
 
Registriert seit: Feb 2003
Ort: München
Beiträge: 15.621
Der erste Teil:
ActionScript:
  1. var numButs = 11;
  2. for (var i = 1; i <= numButs; i++) {
  3.     _root["b" + i].id = i;
  4.     _root["b" + i].onPress = function() {
  5.         bild = this.id;
  6.         fadeOut = !fadeIn && !fadeOut;
  7.     };
  8. }
Am zweiten Teil gäbe es m.E. nicht wirklich was zu optimieren...
Aber generell: Vorsicht mit _root. Lieber die Timeline in eine Variable abspeichern...
__________________
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 22-10-2004, 10:34   #3 (permalink)
Neuer User
 
Registriert seit: Sep 2003
Ort: MC-Pomm
Beiträge: 87
hi sonar,

vielen Dank hab es gleich probiert super!

mfg totty
totty38 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 05:23 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele