Startseite › Foren › Deutsches LiveCode-Forum › Eigener Lautstärkeregler › Antwort auf: Eigener Lautstärkeregler
Februar 20, 2020 um 14:23 Uhr
#19042
Mit der Tastatur? 😀
Na, halt aussen drumherum packen:
on mouseUp
if the environment = "mobile" then
if (mobileSoundOnChannel("background") is empty) or (mobileSoundOnChannel("background") is "could not find channel") then
put (specialFolderPath("resources") & "/sound/background.wav") into tPath
put "background" into tChannelName
put "looping" into tType
mobilePlaySoundOnChannel tPath, tChannelName, tType
else
mobileStopPlayingOnChannel "background"
end if
end if
end mouseUp
Hinweis:
Falls Du hier und in ähnlichen Fällen keinen ELSE Fall benötigst, schreibe ich das immer so, einfach der Übersichtlichkeit halber und um unübersichtliche IF…THEN Klauseln zu vermieden:
on mouseUp
if the environment <> "mobile" then
## Dann einfach nicht weitermachen! :-)
exit mouseup
end if
if (mobileSoundOnChannel("background") is empty) or (mobileSoundOnChannel("background") is "could not find channel") then
put (specialFolderPath("resources") & "/sound/background.wav") into tPath
put "background" into tChannelName
put "looping" into tType
mobilePlaySoundOnChannel tPath, tChannelName, tType
else
mobileStopPlayingOnChannel "background"
end if
end mouseUp