0 Replies Latest reply on May 1, 2013 2:08 PM by anjemalo

    Snap sprites after mouseUp

    anjemalo Level 1

      Hello:

       

      I have a strip of 20 images the width between then is 70 pixels, I am dragging the strip vertically, I need when the MouseUp the strip image snap to the nearest position of my list positions:

       

      the strip images has 2043 height and 100 width.

       

      I have this code but I cannot get it, can you help me please?

      Is there a better way to do it?

      many thanks.

       

      On MouseUp me

            myList=[-1326,-1256,-1186, -1116,-1046,-976, -906,-836,-766,-696, -626,-556,-486,-416, -346,-276,-206,-136,-66,4]

           sortedList = myList.duplicate()

           sortedList.sort()

           Pos=sprite(10).locV

          vIndex = sortedList.findPosNear(Pos)

          sprite(10).locV=sortedList[vIndex]

      end