View Full Version : Sound on mouse over and button to stop them
bobbie
02-06-2006, 11:32 PM
I have some buttons that have a sound on mouse over and they may get to bug someone so is there a way to have a button to turn them off and back if needed?
bobbie
02-06-2006, 11:53 PM
Going to ask how can I show the time on the window?
yosik
02-06-2006, 11:58 PM
As to the sound, just add a button with Audio.TogglePlay action. This would play/pase your audio channel.
I did not understand your second post....
Yossi
Corey
02-07-2006, 12:02 AM
Sure, here you go. :yes
bobbie
02-07-2006, 12:40 AM
Well I have 7 or 8 buttons that each have their own mouse over sound so would need to turn them all on and off .see screenshot
bobbie
02-07-2006, 12:43 AM
I was wondering if you can display the time on the window someplace?
Corey
02-07-2006, 12:50 AM
Hi. In the example above the sound is toggled for all buttons, which should work as you want. See attached for a project which shows the time... :yes
Dermot
02-07-2006, 01:24 AM
To get rid of the mouseover and click sounds, make sure the properties pane is visible, select the buttons and set the HighLightSound and ClickSound to None. See attached image.
I think that is what you were asking, not how to turn off the sounds at runtime.
bobbie
02-07-2006, 01:31 AM
Thanks for the help Corey , guys.
Corey
02-07-2006, 01:36 AM
No problem. :)
TJ_Tigger
02-07-2006, 08:04 AM
Here (http://www.indigorose.com/forums/showpost.php?p=73636&postcount=20) is a function that I wrote that can be used to mute all button objects sound. It will find all the buttons on a page and change the properties so that their sound is set to none.
I realize that the function would toggle everything on the page so here is one just for the button object. This function does not handle custom sounds but shouldn't be too hard to get it to do so.
function ToggleAudio(bAudio)
-- Set local variables
local tbObjects = {};
local tbProps = {};
local Object = nil;
local vSound = nil;
local tbObjectType = {};
tbObjectType[0] = Button;
--Determine if audio should be on or off and set variables
--so turn sound on or off as appropriate
if bAudio then
vSound = SND_STANDARD;--used for object properties
nVol = 100;--used for video and mediaplayer
--Audio.SetVolume(CHANNEL_ALL, 255);--sets audio globally for channels
else
vSound = SND_NONE;
nVol = 0;
--Audio.SetVolume(CHANNEL_ALL, 0);
end
--get the objects on the page if there are objects then proceed
tbObjects = Page.EnumerateObjects();
if tbObjects then
for i,v in tbObjects do --for each item in the table get the type
Object = tbObjectType[Page.GetObjectType(v)];
--if the object existed in the table above then
if Object then
--get the properties for the object
tbProps = Object.GetProperties(v);
--set the sound properties to the variable determined above
tbProps.HighlightSound = vSound;
tbProps.ClickSound = vSound;
--set the properties back to the object
Object.SetProperties(v, tbProps);
end
end
end
end
use ToggleAudio(true) to enable sound on the buttons and ToggleAudio(false) to disable audio on button objects.
Tigg
TJ_Tigger
02-07-2006, 08:37 AM
Ok here is another that keeps track of custom sound buttons.
function ToggleAudio(bAudio)
-- Set local variables
local tbObjects = {};
local tbProps = {};
local Object = nil;
local vSound = nil;
local tbObjectType = {};
tbObjectType[0] = Button;
--Determine if audio should be on or off and set variables
--so turn sound on or off as appropriate
if bAudio then
vSound = SND_STANDARD;--used for object properties
nVol = 100;--used for video and mediaplayer
--Audio.SetVolume(CHANNEL_ALL, 255);--sets audio globally for channels
else
g_tbSndCustom = {}; --used to store custom sounds
vSound = SND_NONE;
nVol = 0;
--Audio.SetVolume(CHANNEL_ALL, 0);
end
--get the objects on the page if there are objects then proceed
tbObjects = Page.EnumerateObjects();
if tbObjects then
for i,v in tbObjects do --for each item in the table get the type
Object = tbObjectType[Page.GetObjectType(v)];
--if the object existed in the table above then
if Object then
--get the properties for the object
tbProps = Object.GetProperties(v);
--Store custom sound information in a table
if bAudio == false and (tbProps.HighlightSound ~= SND_STANDARD or tbProps.ClickSound ~= SND_STANDARD) then
g_tbSndCustom[v]={};
if tbProps.HighlightSound ~= SND_STANDARD then
g_tbSndCustom[v]["HS"] = tbProps.HighlightSound
end
if tbProps.ClickSound ~= SND_STANDARD then
g_tbSndCustom[v]["CS"] = tbProps.ClickSound
end
end
--set the sound properties to the variable determined above
if bAudio and g_tbSndCustom[v] then -- If Both are true then the item contains custom sound
if g_tbSndCustom[v]["HS"] then
tbProps.HighlightSound = g_tbSndCustom[v]["HS"]
end
if g_tbSndCustom[v]["CS"] then
tbProps.ClickSound = g_tbSndCustom[v]["CS"]
end
else
tbProps.HighlightSound = vSound;
tbProps.ClickSound = vSound;
end
--set the properties back to the object
Object.SetProperties(v, tbProps);
end
end
end
end
if bAudio then
ToggleAudio(false);
bAudio = false;
else
ToggleAudio(true);
bAudio = true;
end
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.