how can i drag items from a group and slide the group

hello i’m new in corona sdk 

i have an object group and i want to slide this group and drag item who are in this group , is it possible to do this?

for example :

local widget = require( “widget” )

local scrollView

local icons = {}

local function iconListener( event )

    local id = event.target.id

    if ( event.phase == “moved” ) then

        local dx = math.abs( event.x - event.xStart ) 

        if ( dx > 5 ) then

            scrollView:takeFocus( event ) 

        end

    end

    return true

end

local function showSlidingMenu( event )

    if ( “ended” == event.phase ) then

        scrollView = widget.newScrollView

        {

            width = screenW,

            height = 100,

            scrollWidth = 1200,

            scrollHeight = 100,

            verticalScrollDisabled = true

        }

        scrollView.x = display.contentCenterX

        scrollView.y = 100

        local scrollViewBackground = display.newRect( 600, 50, 1200, 100 )

        --scrollViewBackground:setFillColor( 0, 0, 0)

        scrollView:insert( scrollViewBackground )

        --generate icons

        for i = 1, 20 do

            icons[i] = display.newCircle( i * 56, 50, 22 )

            icons[i]:setFillColor( math.random(), math.random(), math.random() )

            scrollView:insert( icons[i] )

            icons[i].id = i

            icons[i]:addEventListener( “touch”, iconListener )

        end

    end

    return true

end

Runtime:addEventListener(“touch”, showSlidingMenu)

I want to drag the circles that are in the bar and to be able to slide too

I want to do the same thing as this code

local widget = require( “widget” )

local screenGroup = display.newGroup()

 

– Create a ScrollView

local scrollView = widget.newScrollView

{

        left = 0,

        top = 0,

        width = display.contentWidth,

        height = display.contentHeight,

        bottomPadding = 0,

        horizontalScrollDisabled = false,

        verticalScrollDisabled = true,

}

 

 local function onRectangleTouch(event)

      local t  = event.target

      if event.phase == “began” then

        display.getCurrentStage():setFocus( event.target )   

        t.markX = t.x    

        t.markY = t.y

        screenGroup:insert(event.target)

      elseif event.phase == “moved” then

        t.x = (event.x - event.xStart) + t.markX

        t.y = (event.y - event.yStart) + t.markY

      elseif event.phase == “ended”  then

       display.getCurrentStage():setFocus(nil)

      end

      return true

end

 

local rectangle = {}

 

for i=1,3 do

    rectangle[i] = display.newRect( 50 + (i*60), 100, 50, 50 )

    rectangle[i]:setFillColor(1,0,0)

    rectangle[i]:addEventListener(“touch”,onRectangleTouch)

    scrollView:insert( rectangle[i] )

end

 

screenGroup:insert(scrollView)

 

can someone  explain me how it works plz

 

thanks

I want to do the same thing as this code

local widget = require( “widget” )

local screenGroup = display.newGroup()

 

– Create a ScrollView

local scrollView = widget.newScrollView

{

        left = 0,

        top = 0,

        width = display.contentWidth,

        height = display.contentHeight,

        bottomPadding = 0,

        horizontalScrollDisabled = false,

        verticalScrollDisabled = true,

}

 

 local function onRectangleTouch(event)

      local t  = event.target

      if event.phase == “began” then

        display.getCurrentStage():setFocus( event.target )   

        t.markX = t.x    

        t.markY = t.y

        screenGroup:insert(event.target)

      elseif event.phase == “moved” then

        t.x = (event.x - event.xStart) + t.markX

        t.y = (event.y - event.yStart) + t.markY

      elseif event.phase == “ended”  then

       display.getCurrentStage():setFocus(nil)

      end

      return true

end

 

local rectangle = {}

 

for i=1,3 do

    rectangle[i] = display.newRect( 50 + (i*60), 100, 50, 50 )

    rectangle[i]:setFillColor(1,0,0)

    rectangle[i]:addEventListener(“touch”,onRectangleTouch)

    scrollView:insert( rectangle[i] )

end

 

screenGroup:insert(scrollView)

 

can someone  explain me how it works plz

 

thanks