Hello,
I was just wondering how I would be able to make something happen when the slider is stopped at a specific value.
https : / / vimeo . com / 77926435
I want to be able to move to next card when the image is lined up correctly (this is just an example) the slider value for this is 90.
Thanks
Slider Question
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Slider Question
HI calmrr3,
1. welcome to the forum!
2. Use a scrollbar and add a mouseup script to it:
Check these stacks to learn more about the basics of Livecode, maybe start with stack "Controls"
http://www.hyperactivesw.com/revscriptc ... ences.html
Best
Klaus
1. welcome to the forum!

2. Use a scrollbar and add a mouseup script to it:
Code: Select all
on mouseup
## Check the THUMBPOSITION (thumbpos) of the scrollbar!
if the thumbpos of me = 90 then
## do your stuff...
end if
end mouseup

http://www.hyperactivesw.com/revscriptc ... ences.html
Best
Klaus
Re: Slider Question
Thanks! I'll give it a go
Re: Slider Question
This is the the code I am using (hacked together using examples!)
local sWidth, sHeight, sAngle, sScale, sWdim, sHdim, sValue, sLoc
on mouseDown
put the loc of img "branch2" into sLoc
set the lockloc of img "branch2" to false
put the thumbPos of me into sValue
end mouseDown
on mouseup
if the thumbpos of me = 90 then
go to card "card2"
end if
end mouseup
on scrollBarDrag pValue
lock screen
if exists(img "tempImg") then
set the angle of img "tempImg" to pValue - sValue
end if
if sLoc is empty then exit scrollBarDrag
set the loc of img "branch2" to sLoc
if exists(img "tempImg") then set the loc of img "tempImg" to sLoc
unlock screen
end scrollBarDrag
(see vimeo link for demonstration) the problem is:
when I use the slider then deselect it then select it again, the rotated part of the image jumps back to its original position. I want it to remember its position so that I can use specific slider positions to trigger an event - at the moment at value 90 the rotation of the image is not always the same.
Very difficult to explain, sorry!
local sWidth, sHeight, sAngle, sScale, sWdim, sHdim, sValue, sLoc
on mouseDown
put the loc of img "branch2" into sLoc
set the lockloc of img "branch2" to false
put the thumbPos of me into sValue
end mouseDown
on mouseup
if the thumbpos of me = 90 then
go to card "card2"
end if
end mouseup
on scrollBarDrag pValue
lock screen
if exists(img "tempImg") then
set the angle of img "tempImg" to pValue - sValue
end if
if sLoc is empty then exit scrollBarDrag
set the loc of img "branch2" to sLoc
if exists(img "tempImg") then set the loc of img "tempImg" to sLoc
unlock screen
end scrollBarDrag
(see vimeo link for demonstration) the problem is:
when I use the slider then deselect it then select it again, the rotated part of the image jumps back to its original position. I want it to remember its position so that I can use specific slider positions to trigger an event - at the moment at value 90 the rotation of the image is not always the same.
Very difficult to explain, sorry!