Hi Leute,
ich habe mal wieder ein kleines Problem. Ich hab mir ein paar schöne Buttons erstellt ( Schaltflächen) beim Darüberfahren kommt ein Sound , und wenn ich vom einen Button zum anderen fahre wird die Maus von einer Krempe verfolgt.
Ich habe dank Datic das Tutorial "externe Flash Dateien laden" erfplgreich bewältigt.
Nun möchte ich dieses jedoch in meine Seite einbauen. In dem Tutorial liegt das Actionscript auf Movieclips und in meinem Fall brauche ich das auf Schaltflächen, da diese ja die Sound beim Mouseover haben.
das ist der Code aus dem Tutorials auf den Movieclips und diesen möchte ich nun zu dem Actionscript meiner schaltflächen hinzufügen: das findet ihr weiter unten:
Schaltflächenscript
Ich höffe wirklich ihr versteht mein Problem, danke im Vorraus. Christof K
ich habe mal wieder ein kleines Problem. Ich hab mir ein paar schöne Buttons erstellt ( Schaltflächen) beim Darüberfahren kommt ein Sound , und wenn ich vom einen Button zum anderen fahre wird die Maus von einer Krempe verfolgt.
Ich habe dank Datic das Tutorial "externe Flash Dateien laden" erfplgreich bewältigt.
Nun möchte ich dieses jedoch in meine Seite einbauen. In dem Tutorial liegt das Actionscript auf Movieclips und in meinem Fall brauche ich das auf Schaltflächen, da diese ja die Sound beim Mouseover haben.
das ist der Code aus dem Tutorials auf den Movieclips und diesen möchte ich nun zu dem Actionscript meiner schaltflächen hinzufügen: das findet ihr weiter unten:
PHP:
this.onEnterFrame = function() {
// Festlegen der Beschriftungen der Buttons:
button1.setText("1");
button2.setText("2");
button3.setText("3");
delete this.onEnterFrame;
}
var currentContent = 0; // Aktueller Inhalt (0 = keiner)
function setContent(bname) {
var new_content = int(bname.substr(bname.length - 1, 1)); // Nummer holen
if (new_content > 0 && new_content != current_content) {
if (current_content != 0) {
switchContent(new_content); // Inhalt wechseln
} else {
loadContent(new_content); // Inhalt direkt laden
}
} else {
switchContent(0); // Inhalt ausblenden
current_content = 0;
}
}
function switchContent(nc) {
current_content = 0; // Auf Null setzen, damit neue Inhalte schnell angezeigt werden können
this.onEnterFrame = function() {
container._alpha += (0 - container._alpha) / 2; // Container ausblenden
if (container._alpha < 1) {
container._alpha = 0;
if (nc > 0) {
loadContent(nc); // Neuen Inhalt laden,
} else {
delete this.onEnterFrame; // oder anhalten, wenn kein Inhalt
}
}
}
}
function loadContent(nc) {
var stime = getTimer(); // Zeitstempel merken
loader.loadContent(container, getContentName(nc)); // Inhalt laden lassen
this.onEnterFrame = function() {
container._alpha = 0;
if (loader.isloaded == true) { // Wenn geladen:
current_content = nc; // Aktuellen Inhalt setzen
appearContent(); // Inhalt anzeigen
}
if (getTimer() - stime > 8000) { // Timeout beim Laden:
current_content = 0; // Auf Null setzen
container._alpha = 0;
delete this.onEnterFrame;
}
}
}
function appearContent() {
this.onEnterFrame = function() {
container._alpha += (100 - container._alpha) / 2; // Inhalt einblenden
if (container._alpha > 99) {
container._alpha = 100;
delete this.onEnterFrame; // Anhalten
}
}
}
function getContentName(nr) {
switch(nr) {
case 1: return "test4.swf"; break;
case 2: return "test5.swf"; break;
case 3: return "test3.swf"; break;
}
return "nofile.swf";
}
Schaltflächenscript
PHP:
if (_global.wahl ==1) {
if (this.krempe_mc._x>196) {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x -((this.krempe_mc._x -196)/5);
}
} else {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x +((196 - this.krempe_mc._x )/5);
}
}
}
if (_global.wahl ==2) {
if (this.krempe_mc._x>280) {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x -((this.krempe_mc._x -280)/5);
}
} else {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x +((280 - this.krempe_mc._x )/5);
}
}
}
if (_global.wahl ==3) {
if (this.krempe_mc._x>364.5) {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x -((this.krempe_mc._x -364.5)/5);
}
} else {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x +((364.5 - this.krempe_mc._x )/5);
}
}
}
if (_global.wahl ==4) {
if (this.krempe_mc._x>449.0) {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x -((this.krempe_mc._x -449.0)/5);
}
} else {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x +((449.0 - this.krempe_mc._x )/5);
}
}
}
if (_global.wahl ==5) {
if (this.krempe_mc._x>533.5) {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x -((this.krempe_mc._x -533.5)/5);
}
} else {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x +((533.5 - this.krempe_mc._x )/5);
}
}
}
if (_global.wahl ==6) {
if (this.krempe_mc._x>618.5) {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x -((this.krempe_mc._x -618.5)/5);
}
} else {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x +((618.5 - this.krempe_mc._x )/5);
}
}
}
if (_global.wahl ==7) {
if (this.krempe_mc._x>703.5) {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x -((this.krempe_mc._x -703.5)/5);
}
} else {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x +((703.5 - this.krempe_mc._x )/5);
}
}
}
if (_global.wahl ==8) {
if (this.krempe_mc._x>788.5) {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x -((this.krempe_mc._x -788.5)/5);
}
} else {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x +((788.5 - this.krempe_mc._x )/5);
}
}
}
if (_global.wahl ==9) {
if (this.krempe_mc._x>873.5) {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x -((this.krempe_mc._x -873.5)/5);
}
} else {
with (this.krempe_mc) {
this.krempe_mc._x = this.krempe_mc._x +((873.5 - this.krempe_mc._x )/5);
}
}
}
Ich höffe wirklich ihr versteht mein Problem, danke im Vorraus. Christof K