8/24/2010 10:17:17 PM
Title:
Sound on tooltip
Is is possible to have a sound when showing tooltip on something?
Inder
Points: 2980
Posts:0
8/24/2010 10:27:20 PM
to play a sound on show tooltip event you can use the following code
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init()">
<mx:Script><![CDATA[
import mx.events.ToolTipEvent;
import flash.media.Sound;
[Embed(source="../assets/toolTipSound.mp3")]
private var myToolTipSound:Class;
private var mySound:Sound;
public function playSound():void {
mySound.play();
}
private function myListener(event:ToolTipEvent):void {
playSound();
}
private function init():void {
myLabel.addEventListener(ToolTipEvent.TOOL_TIP_SHOW, myListener);
mySound = new myToolTipSound();
}
]]></mx:Script>
<mx:Label id="myLabel" toolTip="ToolTip" text="Mouse over me to hear tooltip sound"/>
</mx:Application>