Custom circle sliders
Posted: Fri Apr 07, 2006 6:09 pm
This tutorial will let you create a custom circle slider that will put a percent value in a variable when you drag the thumb. I will show 2 variations of it. One full circle slider and one half circle slider.
Full circle slider:
1.) Make sure you have ArcadeEngine in use (load the stack into memory and type into the messagebox:
start using stack "ArcadeEngine"
2.) create a stack
3.) Create a button
4.) set the name of the buton to "mySliderThumb"
5.) type into the messageBox:
set the constrainCircular of button "mySliderThumb" to the loc of this card,80
6.) put the following script into the button:
7.) Choose Browse tool and drag the button. The percent value will be put into the messagebox.
If you want the slider to not travel the whole circle path change the script of button "mySliderThumb"
Half circle Slider
If you have any questions feel free to ask.
Malte
Full circle slider:
1.) Make sure you have ArcadeEngine in use (load the stack into memory and type into the messagebox:
start using stack "ArcadeEngine"
2.) create a stack
3.) Create a button
4.) set the name of the buton to "mySliderThumb"
5.) type into the messageBox:
set the constrainCircular of button "mySliderThumb" to the loc of this card,80
6.) put the following script into the button:
Code: Select all
on mouseMove
local thePercent,theAngle
put item 1 of the constrainCircular of me into myX
put item 2 of the constrainCircular of me into myY
put findAngleX(myX,myY, the mouseLoc) into theAngle
put theAngle/3.6 into thePercent
--do something wit thePercent here
put thePercent
pass mouseMove
end mouseMove
If you want the slider to not travel the whole circle path change the script of button "mySliderThumb"
Half circle Slider
Code: Select all
on mouseMove
local thePercent,theAngle
put item 1 of the constrainCircular of me into myX
put item 2 of the constrainCircular of me into myY
put findAngleX(myX,myY, the mouseLoc) into theAngle
if theAngle<90 then
put 90 into theAngle
set the loc of me to pointOncircle(myX,myY,90,\
item 3 of the constrainCircular of me)
put (theAngle-90)/1.8 into thePercent
put thePercent
--do someThing with thePercent here
exit mouseMove
end if
if theAngle>270 then
set the loc of me to pointOncircle(myX,myY,270,\
item 3 of the constrainCircular of me)
put 270 into theAngle
put (theAngle-90)/1.8 into thePercent
put thePercent
--do someThing with thePercent here
exit mouseMove
end if
put (theAngle-90)/1.8 into thePercent
put thePercent
pass mouseMove
end mouseMove
Malte