scrollview in director with multiple buttons

Hello,

I am new and inexperienced in LUA and Corona but i want to create a scrollview in director with multiple buttons. I have create a seperate display.newGroup with the name “Mylist” for the buttons.
But the buttons do not seem the work when i insert a scrollview. see the code below.

please some help?

thank you

[lua]module(…, package.seeall)

_W = display.contentWidth
_H = display.contentHeight

function new(Params)

local ui = require ( “ui” )
local scrollView = require(“scrollView”)
local util = require(“util”)

local localGroup = display.newGroup()
local background = display.newImage( “bg.png” )
local header = display.newImage( “header.png” )
local topBoundary = display.screenOriginY
local bottomBoundary = display.screenOriginY +50
local scrollView = scrollView.new{ top=topBoundary, bottom=bottomBoundary }

local Mylist = display.newGroup()

local btn1 = function( event )
if event.phase == “release” then
director:changeScene( “newsscreen1”, “moveFromRight” )
end

end

local btn2 = function ( event )
if event.phase == “release” then
director:changeScene( “newsscreen2”, “moveFromRight” )
end
end

local btn3 = function ( event )
if event.phase == “release” then
director:changeScene( “newsscreen3”, “moveFromRight” )
end
end

local btn4 = function ( event )
if event.phase == “release” then
director:changeScene( “newsscreen4”, “moveFromRight” )
end
end

local btn5 = function ( event )
if event.phase == “release” then
director:changeScene( “newsscreen5”, “moveFromRight” )
end
end

local btn6 = function ( event )
if event.phase == “release” then
director:changeScene( “newsscreen6”, “moveFromRight” )
end
end

local btn6 = function ( event )
if event.phase == “release” then
director:changeScene( “newsscreen7”, “moveFromRight” )
end
end

local btn8 = function ( event )
if event.phase == “release” then
director:changeScene( “newsscreen8”, “moveFromRight” )
end
end

– UI Objects

local btn1 = ui.newButton{
default = “listItemBg.png”,
over = “listItemBg_over.png”,
onEvent = btn1,
id = “btn1”
}

local btn2 = ui.newButton{
default = “listItemBg.png”,
over = “listItemBg_over.png”,
onEvent = btn2,
id = “btn2”
}

local btn3 = ui.newButton{
default = “listItemBg.png”,
over = “listItemBg_over.png”,
onEvent = btn3,
id = “btn3”
}

local btn4 = ui.newButton{
default = “listItemBg.png”,
over = “listItemBg_over.png”,
onEvent = btn4,
id = “btn4”
}

local btn5 = ui.newButton{
default = “listItemBg.png”,
over = “listItemBg_over.png”,
onEvent = btn5,
id = “btn5”
}

local btn6 = ui.newButton{
default = “listItemBg.png”,
over = “listItemBg_over.png”,
onEvent = btn6,
id = “btn6”
}

local btn7 = ui.newButton{
default = “listItemBg.png”,
over = “listItemBg_over.png”,
onEvent = btn7,
id = “btn7”
}

local btn8 = ui.newButton{
default = “listItemBg.png”,
over = “listItemBg_over.png”,
onEvent = btn8,
id = “btn8”
}

local initVars = function ()


– Inserts

localGroup:insert( background )
localGroup:insert( header )
localGroup:insert(Mylist)

Mylist:insert( btn1 )
Mylist:insert( btn2 )
Mylist:insert( btn3 )
Mylist:insert( btn4 )
Mylist:insert( btn5 )
Mylist:insert( btn6 )
Mylist:insert( btn7 )
Mylist:insert( btn8 )

scrollView:insert( Mylist)


– Positions

header.x = _W/2
header.y = _H - 449

btn1.x = _W/2
btn1.y = _H - 356

btn2.x = _W/2
btn2.y = _H - 263

btn3.x = _W/2
btn3.y = _H - 170

btn4.x = _W/2
btn4.y = _H - 77

btn5.x = _W/2
btn5.y = _H + 16

btn6.x = _W/2
btn6.y = _H + 109

btn7.x = _W/2
btn7.y = _H + 202

btn8.x = _W/2
btn8.y = _H + 295

end


– Initiate variables

initVars()


– MUST return a display.newGroup()

return localGroup
end

[lua] [import]uid: 117593 topic_id: 22848 reply_id: 322848[/import]