home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Boot Disc 5
/
boot-disc-1997-01.iso
/
media
/
utility.cst
/
00017_Script_SoundClass
< prev
next >
Wrap
Text File
|
1996-11-05
|
3KB
|
104 lines
property spritenum,minval,maxval,orient,changeflag,soundtextlist,ancestor
on new me,myminval,mymaxval,myorient
global SoundObj
set soundtextlist=["mute","very quiet","quiet","average","medium loud","loud","very loud","speaker bustin'"]
if voidP(myorient) then
set orient=#hor
else
set orient=myorient
end if
set minval=myminval
set maxval=mymaxval
set spritenum=castsprite("soundThumb")
if spritenum=0 then
alert("Can't find a cast member named 'soundThumb'")
halt
end if
puppetsprite spritenum,true
setsoundpos(me)
set SoundObj=me
-- clearactorlist me
-- add the actorlist,me
set ancestor=new(script "GenericClass")
return me
end
on clearactorlist me
set olddelimiter=the itemdelimiter
set the itemdelimiter=quote
repeat with obj in the actorlist
if item 2 of string(obj)="SoundClass" then
if spritenum=the spritenum of obj then
set pos=getpos(the actorlist,obj)
deleteat the actorlist,pos
exit repeat
end if
end if
end repeat
end
on setsoundpos me
set curlevel=the soundlevel-1
set curpos=minval+curlevel*(maxval-minval)*1.0/7
if orient=#hor then
set the locH of sprite spritenum to curpos
else
set the locV of sprite spritenum to curpos
end if
updateStage
end
on stepframe
if changeflag then
repeat while the mousedown
if orient=#hor then
set curpos=min(max(the mouseH,minval),maxval)
set the locH of sprite spritenum=curpos
updateStage
else
set curpos=min(max(the mouseV,minval),maxval)
set the locV of sprite spritenum=curpos
updateStage
end if
set curlevel=(7*(curpos-minval)*1.0/(maxval-minval))+1
set the soundlevel=curlevel
global gStatus
setbtntext gStatus,"soundThumb","The volume is "&getat(soundtextlist,curlevel)&"."
if not the mousedown then
setbtntext gStatus,"soundThumb","Changes the volume."
set changeflag=false
end if
end repeat
end if
end
on setsoundlevel me
repeat while the mousedown
if orient=#hor then
set curpos=min(max(the mouseH,minval),maxval)
set the locH of sprite spritenum=curpos
updateStage
else
set curpos=min(max(the mouseV,minval),maxval)
set the locV of sprite spritenum=curpos
updateStage
end if
set curlevel=(8*(curpos-minval)*1.0/(maxval-minval))
set the soundlevel=curlevel
-- global gStatus
-- setbtntext gStatus,"soundThumb","The volume is "&getat(soundtextlist,curlevel)&"."
-- if not the mousedown then
-- setbtntext gStatus,"soundThumb","Changes the volume."
-- set changeflag=false
-- end if
end repeat
end
on dispose me
puppetsprite spritenum,false
clearactorlist me
set me=0
end