But I get error-
variable used before assigned a value
You need to declare global vol at the top of each of your mouseUp
handlers.
Try:
on startMovie
global vol
set vol to 4
set the soundLevel to vol
end
-- for volume [ + ]
on mouseUp
global vol
if vol 7 then
set vol
You haven't declared 'vol' as a global in the scripts for the volume up and
volume down.
You can also shorten your scripts like so:
For volume [+]
on mouseUp me
global vol
vol = max(7, vol + 1)
the soundLevel = vol
end mouseUp me
For volume [-]
on mouseUp me
global vol
vol = min(0, vol