FANDOM


This is a tutorial for building a custom touch slider.

A little history Edit

I was trying to fall asleep for who knows how long, when I was struck with inspiration. I would write it down on a sheet of paper and then send it to YYY, who I had heard was looking for one. I had not tested it out when I sent it to him, and he was more then skeptical. I, being stubborn as I am, had decided I would test out the SHORT code and see if it would work. Lo and behold I was left with what you see below and a working custom slider.


Current version Edit

.9

- Working on fine tuning the code so that it will remember the position of the last touch and make that the original position for a smoother scroll.


What you will need Edit

You will need two images:

  • Slider.png
  • Panel.png

The Panel will be the section moving opposite to the scroller (slider).

The code - straight up Edit

<widget>
  <debug>verbose</debug>
  
  <window>
    <width>1000</width>
    <height>1000</height>
    
    <image>
      <height>400</height>
      <width>20</width>
      <src>Slider.png</src>
      <name>slider</name>
      <vOffset>0</vOffset>
      <onMouseMove><![CDATA[
        panel.vOffset = slider.vOffset - system.event.vOffset
      ]]></onMouseMove>
    </image>
    
    <image>
      <src>Panel.png</src>
      <name>panel</name>
      <vOffset>0</vOffset>
      <hOffset>30</hOffset>
    </image>
    
  </window>
  
</widget>

The reasoning Edit

First I establish the basics, the

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.