flash button mit sound?

enemy2k

Mitglied
Hallo. Ich möchte in ein Button wo ich schon eine animation habe noch einen sound hinzufügen, der aber nur abgespielt wird wenn man über den button drübergeht. also nicht dass es immer wieder gespielt wird solange das movie gespielt wird.

im anhang sind ein paar bilder zur verdeutlichung, und wie folgt der code für die animation:

Code:
stop ();
this.onEnterFrame = function(){
if(rewind == true){
prevFrame();
}
}
this.onRollOver = function(){
rewind = false;
play();
}
this.onRollOut = function(){
rewind = true;
}
this.onRelease = function(){
getURL("#", "_blank");
}

und am ende der aktion:

Code:
stop();

wo kann ich jetzt noch ein sound hinzufügen dass nur beim mouseover abgespielt wird, sonst auf stop ist...
 

Anhänge

  • Clipboard01.jpg
    Clipboard01.jpg
    36,5 KB · Aufrufe: 23
Hallo,

importiere ein mp3-File in deine Bibliothek und exportier das Sound-Symbol für AS, z.B. mit dem Identifier "mySound".

Dein Code modifizierst du wie folgt:

PHP:
stop ();
//
var rollOverSound = new Sound();
rollOverSound.attachSound("mySound");

//beim rollOver
this.onRollOver = function(){
   rewind = false;
   play();
   rollOverSound.start();
}

gruss
 
Zurück