widget.newScrollView poblem

hey guys.

i am having a problem…

i have 5 buttons in my app in which 5th button is off stage(off white screen in the picture below)…

Now, i can only scroll down when i scroll from the white portion…when i try to scroll down from the buttons area, it doest scroll…instead the button gets clicked (it comes to onPress stage)…so any suggestions how could i scroll down from the buttons area???

Coding:

   bg = display.newRect(_x/2,_y/2,_x,_y+1350)

   

   bg2 = display.newRect(_x/2, -100, _x, 170)

   bg2:setFillColor(0.85,0,1)

   

   bg3 = display.newRect(_x/2,1130, _x, 170)

   bg3:setFillColor(0.85,0,1)

   

   subject = display.newImage(“bg/head.png”,_x/2,170)

   subject.yScale = 0.5

   subject.xScale = 1.4

   

------------------buttons-----------------------------

-------------------texts------------------------------

button1 = widget.newButton

{

  left = 85,

  top = _x/2,

  width = 600,

  height = 150,

  defaultFile = “bg/button.jpg”,

  overFile = “bg/buttonP.jpg”,

  onRelease= onButton1

}

text1 = display.newText(“Question Bank”,_x/2- 4,_y/2-50,“TEMPSITC”,60)

button2 = widget.newButton

{

  left = 85,

  top = _x/2 + 150 ,

  width = 600,

  height = 150,

  defaultFile = “bg/button.jpg”,

  overFile = “bg/buttonP.jpg”,

  onRelease= onButton2

}

text2 = display.newText(“NCERT Solutions”,_x/2- 4,_y/2+100,“TEMPSITC”,60)

button3 = widget.newButton

{

  left = 85,

  top = _x/2 + 300,

  width = 600,

  height = 150,

  defaultFile = “bg/button.jpg”,

  overFile = “bg/buttonP.jpg”,

  onRelease= onButton3

}

text3 = display.newText(“Sample papers”,_x/2- 4,_y/2+250,“TEMPSITC”,60)

button4 = widget.newButton

{

  left = 85,

  top = _x/2 + 450,

  width = 600,

  height = 150,

  defaultFile = “bg/button.jpg”,

  overFile = “bg/buttonP.jpg”,

  onRelease= onButton4

}

text4 = display.newText(“Tips for Studies”,_x/2- 4,_y/2+400,“TEMPSITC”,60)

button5 = widget.newButton

{

  left = 85,

  top = _x/2 + 600,

  width = 600,

  height = 150,

  defaultFile = “bg/button.jpg”,

  overFile = “bg/buttonP.jpg”,

  onRelease= onButton5

}

text5 = display.newText(“Contact us”,_x/2- 4,_y/2+550,“TEMPSITC”,60)



    

sceneGroup:insert(bg)

sceneGroup:insert(bg3)

sceneGroup:insert(bg2)

sceneGroup:insert(subject)



----------SCROLL VIEW-------------------------------

scrollView = widget.newScrollView

        {

           top= -10,

           left=0,

           topPadding=-10,

           bottomPadding=-300,

           width = _x,

           height= _x+290,

           horizontalScrollDisabled = true,

           verticalScrollDisabled= false,

  

        }

  scrollView:insert(button1)

  scrollView:insert(button2)

  scrollView:insert(button3)

  scrollView:insert(button4)

  scrollView:insert(button5)

  scrollView:insert(text1)

  scrollView:insert(text2)

  scrollView:insert(text3)

  scrollView:insert(text4)

  scrollView:insert(text5)

  scrollView:insert(subject)

  sceneGroup:insert(scrollView)

In that pic… i only want to scroll the buttons, texts, and the heading( Social Science)…i dont wanna scroll the purple rectangle ends.

thanks

please someone help me…its urgent

Please only post your question once.  Also please use code tags when posting code.

You need to add a listener function to your buttons to grab the touch and pass it to the scrollview. 

Here is an example:

local function touchListener(event) local phase = event.phase if phase == "moved" then local dy = math.abs( event.y - event.yStart ) if dy \> 12 then myScrollView:takeFocus( event ) return end end end

please someone help me…its urgent

Please only post your question once.  Also please use code tags when posting code.

You need to add a listener function to your buttons to grab the touch and pass it to the scrollview. 

Here is an example:

local function touchListener(event) local phase = event.phase if phase == "moved" then local dy = math.abs( event.y - event.yStart ) if dy \> 12 then myScrollView:takeFocus( event ) return end end end