Startseite › Foren › Deutsches LiveCode-Forum › Eigener Lautstärkeregler › Antwort auf: Eigener Lautstärkeregler
Februar 19, 2020 um 21:48 Uhr
#19030
Also ich habe dein Script nicht mehr sondern folgendes:
local topValue,tScaleFactor,Bstop,Tstop,xLoc,cY,canMove,
on mouseDown
# Geben Sie Ihren Startwert (oben) ein
put 100 into topValue
# FÜGEN SIE IHREN ENDWERT (UNTEN) EIN
put 1 into bottomValue
# ERHALTEN SIE DEN OFFSET DES KLICKPUNKTES UND DES ZENTRUMS DES BTN
# Dies verhindert, dass der BTN springt, wenn Sie mit dem Ziehen beginnen
put (the mouseV - item 2 of the loc of me) into cY
# Die Zahl, die am Ende der nächsten 3 Zeilen addiert oder subtrahiert wird
# dient dazu, die Position des Schiebereglers so zu ändern, dass er an der gewünschten Stelle stoppt
put (the bottom of image "Vsliderbar1")-(the height of me/2)+cY +7 into Bstop
put (the top of image "Vsliderbar1")+(the height of me/2)+cY -27 into Tstop
put item 1 of the loc of image "Vsliderbar1" +9 into xLoc
put (bottomValue-topValue)/(Bstop-Tstop) into tScaleFactor
put true into canMove
end mouseDown
on mouseMove x,y
if not canMove then exit mouseMove
put min(Bstop,max(Tstop,y)) into yLoc
set loc of me to xLoc,yLoc-cY
# Möglicherweise müssen Sie folgende Werte hinzufügen: xLoc und yLoc
#, um den Wert fld an der gewünschten Stelle zu positionieren
set the loc of fld "theValue_v1" to xLoc-40,yLoc-cY+10
# Die folgende Zeile berechnet den Wert, den Sie möchten
# wird auch für die tatsächliche Funktion des Schiebereglers verwendet
put round((yLoc-Tstop)*tScaleFactor)+topValue into fld "theValue_v1"
put round((yLoc-Tstop)*tScaleFactor)+topValue into noiseOne
##set the playloudness to noise1
mobileSetSoundChannelVolume noise1, "noiseOne" ##diese Zeile hinzugefügt
end mouseMove
on mouseUp
put false into canMove
end mouseUp
on mouseRelease
mouseUp
end mouseRelease
Und da kommt jetzt leider eine Fehlermeldung, wenn ich den Slider bewege.
