Ask a Question related to Macromedia Director Lingo, Design and Development.
-
WWX webforumsuser@macromedia.com #1
Global sound setup
Hi,
I am trying to setup global sound behaviour and attached to files to demostrate what I have done so far, but there is still some mistakes.
First when the movie is started, then global gTheSoundOn is set to be true, yet the sound will not play when moving over the test button.
Secondly when moving over the sound on/off button for the first time it will turn to display the sound off state although no mouse click has been issued.
Thirdly, after clicking the sound on/off button and then moving off it, the display of the sound state is correctly dispalyed until the user move from one movie to the next. The sound on/off setting is correctly retained moving from one moving to the next, but the button display is incorrect.
Please help.
Thanks
WWX webforumsuser@macromedia.com Guest
-
How to setup global values or configuration forcontainers
I want to setup up standard widths and heights, etc. and wondered what the best method is to do this. For example, I want to setup the width of... -
Page setup/paper setup
Hi I use Freehand MXa in MacOSX 13.2. I wonder, does Freehands own paper setup (in print dialog box) owerride all paper setup settings.(In... -
global sound and playlist
I am making a music control panel. I have 4 music tracks that I want the user to be able to skip through. I used this lingo for the playlist and... -
Global Error handling in Applicatio_Error() of Global.asax
Hi all, For a web application if we are using web farm, and if i want to do Global Error handling can i use Applicatio_Error() method in... -
help to setup a sound email service via sendmail
Hello, As a first step, I want the outgoing email work. Currently I cannot send email using sendmail on RH8.0. The error message: type 1:... -
WWX webforumsuser@macromedia.com #2
Re: Global sound setup
Missed the attachment first time round.
[url]http://webforums.macromedia.com/attachments/Sound11.zip[/url]
WWX webforumsuser@macromedia.com Guest
-
WWX webforumsuser@macromedia.com #3
Re: Global sound setup
Oaky I am still struggling with this.
So far I have done the following:
Created teo movies with the following lingo in the Behaviour channel:
global gTheSoundOn
on prepareMovie
gTheSoundOn = True
end
on startMovie
if gTheSoundOn = True then
sprite(1).member = "Sound"
else
sprite(1).member = "Sound_off"
end if
end
on exitFrame me
go to the Frame
end
I also placed two simple button on the stage, one to turn the sound on and off and one to test if it is working i.e. if the mouse scroll over it and the sound is off no sound must be heard. The sound on/off button must also correctly display the sound state.
To these I have assigned the following script respectively.
The Sound on/off button:
global gTheSoundOn
on mouseEnter me
sprite(1).member = "Sound_over"
end mouseEnter
on mouseLeave me
if gTheSoundOn = True then
sprite(1).member = "Sound"
else
sprite(1).member = "Sound_off"
end if
end mouseLeave
on mouseUp me
gTheSoundOn = not gTheSoundOn
if gTheSoundOn = True then
sprite(1).member = "Sound"
else
sprite(1).member = "Sound_off"
end if
end
And the Test button:
global gTheSoundOn
on mouseEnter me
sprite(2).member = "Test_over"
if gTheSoundOn then
sound(2).play(member("zap"))
else
nothing
end if
end
on mouseUp me
go to movie "test_sound2"
end mouseUp
Well I am getting closer to solve this problem but at present the following hick-ups still needs to be sorted out.
Once I start running the movie the sound is off although I thought my code would have it to be on. The sound on/off button display as if the sound is on, but simply moving over it will change it to the sound off display which correctly reflects the sound state, but then it was suppose to be on, also the user should not have to move over the sound button to get it to correctly display the sound state.
However once I have clicked on the sound on/button it's display and the sound state is then insync until I move from the one movie to the next. The sound state would be correctly get between the movies but the button display will not. For example if I turn the sound off in the one movie and move to the next, the sound will still be off, but the sound on/off button will now display the sound on state until the mouse moves over it after which it change to display the sound off state. (which off course is correct)
Hope to get some help soon.
Thanks
WWX webforumsuser@macromedia.com Guest
-
Christian Grass #4
Here you go
create the following members:
-----------------------------
-- for your sound switch
"SoundOff"
"SoundOn"
-- for your sound status indicator
"SoundOffIndicator"
"SoundOnIndicator"
-- your sound member
"mySound"
create this behaviour and attach it to your sound switch:
---------------------------------------------------------
property spriteNum
global SoundOn
on mouseUp
if (SoundOn = 1) then
SoundOn = 0
else if (SoundOn = 0) then
SoundOn = 1
(sprite spriteNum).member = member("SoundOn")
end if
updateStage
end mouseUp
--------------
create this behaviour and attach it to the frame:
---------------------------------------------------------------------------------
global SoundOn
-- control the sound of your movie by simply setting this variable
anywhere you want
-- note that you have to attach this script to the according frame
-- 0: sound is off
-- 1: sound is on
on exitFrame
go to the frame
end exitFrame
on idle
-- you could also test for other variables here, e.g. if a movie plays
currently
if (SoundOn = 0) then
sound Stop 1
sprite(1).member = member("SoundOff")
sprite(2).member = member("SoundOffIndicator")
else if SoundOn = 1 then
if soundBusy(1) = false then -- leave out this and the next 3 lines if
you don't wanna fade it
sound(1).play(member ("mySound")) -- your sound member
sound(1).fadeIn(3000) -- fade in sound (adjust value to alter the
fade time)
end if
sprite(1).member = member("SoundOn")
sprite(2).member = member("SoundOnIndicator")
end if
end
-------
write this into your movie script:
----------------------------------
global SoundOn
on prepareMovie
set the volume of sound 1 to 150
set SoundOn = 1
end
------
Hope this helps
Chris
Christian Grass Guest
-
Christian Grass #5
Here you go
create the following members:
-----------------------------
-- for your sound switch
"SoundOff"
"SoundOn"
-- for your sound status indicator
"SoundOffIndicator"
"SoundOnIndicator"
-- your sound member
"mySound"
create this behaviour and attach it to your sound switch:
---------------------------------------------------------
property spriteNum
global SoundOn
on mouseUp
if (SoundOn = 1) then
SoundOn = 0
else if (SoundOn = 0) then
SoundOn = 1
(sprite spriteNum).member = member("SoundOn")
end if
updateStage
end mouseUp
--------------
create this behaviour and attach it to the frame:
---------------------------------------------------------------------------------
global SoundOn
-- control the sound of your movie by simply setting this variable
anywhere you want
-- note that you have to attach this script to the according frame
-- 0: sound is off
-- 1: sound is on
on exitFrame
go to the frame
end exitFrame
on idle
-- you could also test for other variables here, e.g. if a movie plays
currently
if (SoundOn = 0) then
sound Stop 1
sprite(1).member = member("SoundOff")
sprite(2).member = member("SoundOffIndicator")
else if SoundOn = 1 then
if soundBusy(1) = false then -- leave out this and the next 3 lines if
you don't wanna fade it
sound(1).play(member ("mySound")) -- your sound member
sound(1).fadeIn(3000) -- fade in sound (adjust value to alter the
fade time)
end if
sprite(1).member = member("SoundOn")
sprite(2).member = member("SoundOnIndicator")
end if
end
-------
write this into your movie script:
----------------------------------
global SoundOn
on prepareMovie
set the volume of sound 1 to 150
set SoundOn = 1
end
------
Hope this helps
Chris
Christian Grass Guest



Reply With Quote

