Android Question Drag & Drop

samannnn

Member
i use drag & Drop class.
but problem is when i want to drag an object that is moving at the first i should click on it to stop moving and after that i can drag it.
1- is there any better library for Drag&Drop?
2- how can i release class for new object?
3- how can i solve moving problem?

could anyone help me?
thank you.

B4X:
Sub worm_Touch (Action As Int, X As Float, Y As Float) As Boolean 'Return True to consume the event
    If worm.Visible=True And worm.Tag=0 Then
        worm.Tag=1 'return worm to start point
        Log("Click on worm")
        timerwormmove.Enabled=False
        worm.SetBackgroundImage(LoadBitmap(File.DirAssets,"henworm1.png"))
        WromDrag.Initialize(Activity,worm,hole(0),hole(1),hole(2))

    End If
    Return False
End Sub

B4X:
Sub timerwormmove_tick
    If worm.Left>-15%x Then
        If worm.Tag=0 Then
            worm.Tag=1
            worm.SetBackgroundImage(LoadBitmap(File.DirAssets,"henworm1.png"))
'            worm.Left=worm.Left-5%x
            worm.SetLayoutAnimated(timerwormmove.Interval,worm.Left-5%x,worm.Top,11%x,worm.Height)
        Else if worm.Tag=1 Then
            worm.Tag=0
            worm.SetLayoutAnimated(timerwormmove.Interval,worm.Left-7%x,worm.Top,13%x,worm.Height)
            worm.SetBackgroundImage(LoadBitmap(File.DirAssets,"henworm0.png"))
        End If
    Else
        worm.Left=100%x
    End If
End Sub
 
Top