Sometimes we may need to have a sound when we hover over something, i.e when a tooltip appears.
Actually this can be done easily by adding an eventListener to the corresponding control.
Take a look at the example.
This line is the important line.
myLabel.addEventListener(ToolTipEvent.TOOL_TIP_SHOW, myListener);
The function myListener gets called when we hover over the label thus producing the sound.
What you have to do is to just copy and paste the following code to your file.
import mx.events.ToolTipEvent; import flash.media.Sound; [Embed(source="msgAlert.mp3")] private var myToolTipSound:Class; private var mySound:Sound; private function init():void { myLabel.addEventListener(ToolTipEvent.TOOL_TIP_SHOW, myListener); mySound = new myToolTipSound(); } public function playSound():void { mySound.play(); } private function myListener(event:ToolTipEvent):void { playSound(); } ]]>
Would you be thinking about exchanging hyperlinks?
Yes ofcourse.
BION I’m impsresed! Cool post!