Need to add scroll to this page.

Ok, so i have this code and i need to know how to make the page scroll…i have been trying for days…can anyone help ? please ! 

module(…, package.seeall)

function new()    

    

    local localGroup = display.newGroup()        

    

    – change scene function

    function changeScene(e)

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

            director:changeScene(e.target.scene, “moveFromRight”);

        end

    end            

local function onSendSMS( event )

    – compose an SMS message (doesn’t support attachments)

    local options =

    {

       body = "https://itunes.apple.com/

    }

    native.showPopup(“sms”, options)

    

   

end

    

   

–    local btn_back = display.newImageRect(“buton-back.png”, 108, 65 )

–        btn_back:setReferencePoint(display.CenterReferencePoint);

–        btn_back.x = _w/2-255;

–        btn_back.y = _h/2-440;

–        btn_back.scene = “welders1”;

–        btn_back:addEventListener(“touch”, changeScene);

        

–    local btn_bg = display.newImageRect(“BG-categorii.png”, 640, 780 )

–        btn_bg:setReferencePoint(display.CenterReferencePoint);

–        btn_bg.x = _w/2;

–        btn_bg.y = _h/2-11;

    

    local btn_homeicon = display.newImage(“Home-icon.png”)

        btn_homeicon:setReferencePoint(display.CenterReferencePoint);

        btn_homeicon.x = _w/2-239;

        btn_homeicon.y = _h/2+420;

        btn_homeicon.scene = “index”;

        btn_homeicon:addEventListener(“touch”, changeScene);

        

    local btn_inviteicon = display.newImage(“Invite-icon.png”)

        btn_inviteicon:setReferencePoint(display.CenterReferencePoint);

        btn_inviteicon.x = _w/2-74;

        btn_inviteicon.y = _h/2+420;

        btn_inviteicon:addEventListener(“touch”, onSendSMS);

        

    local btn_workersicon = display.newImage(“Workers-icon.png”)

        btn_workersicon:setReferencePoint(display.CenterReferencePoint);

        btn_workersicon.x = _w/2+83;

        btn_workersicon.y = _h/2+420;

        btn_workersicon.scene = “workers”;

        btn_workersicon:addEventListener(“touch”, changeScene);

        

    local btn_shareicon = display.newImage(“Share-icon.png”)

        btn_shareicon:setReferencePoint(display.CenterReferencePoint);

        btn_shareicon.x = _w/2+243;

        btn_shareicon.y = _h/2+420;

        btn_shareicon.scene = “share”;

        btn_shareicon:addEventListener(“touch”, changeScene);

    


local background2 = display.newImageRect( “bb-Burcescu-Victor.png”, 585, 86 )

    background2.x = 315

    background2.y = 70

    background2.scene = “welders3”;

    background2:addEventListener(“touch”, changeScene); 

    scrollView:insert( background2 )

    

    

local background3 = display.newImageRect( “bb-Nicolae-Constantin.png”, 585, 86 )

    background3.x = 315

    background3.y = 170

    background3.scene = “welders3”;

    background3:addEventListener(“touch”, changeScene); 

    scrollView:insert( background3 )

    

local background3 = display.newImageRect( “bb-Nicolae-Constantin.png”, 585, 86 )

    background3.x = 315

    background3.y = 270

    background3.scene = “welders3”;

    background3:addEventListener(“touch”, changeScene); 

    scrollView:insert( background3 )

    

local background3 = display.newImageRect( “bb-Nicolae-Constantin.png”, 585, 86 )

    background3.x = 315

    background3.y = 370

    background3.scene = “welders3”;

    background3:addEventListener(“touch”, changeScene); 

    scrollView:insert( background3 )

    


bgImage2 = display.newImageRect( “bara-neagra.png”, 640, 92 )

bgImage2.x = 320; 

bgImage2.y = 46;



        

    — insert everything into the localGroup

–    localGroup:insert(rowTitle)

–    localGroup:insert(rowTitle2)

–    localGroup:insert(row)

–    localGroup:insert(btn_bg)

–    localGroup:insert(btn_back)

    localGroup:insert(btn_homeicon)

    localGroup:insert(btn_inviteicon)

    localGroup:insert(btn_workersicon)    

    localGroup:insert(btn_shareicon)

    localGroup:insert(btn_shareicon)

    localGroup:insert(bgImage2)

    

    

    

    clean = function ()

    

    end

    

    

    return localGroup

    

end

Where are you creating your scrollView? or including the widget library?

Sorry ! i don’t understand. :frowning:

You have this line of code:  

      scrollView :insert( background2 )

I don’t see where you ever create the scrollView object.  I also don’t see where you are doing:

      local widget = require(“widget”)

to include the widget library.  That is if your scrollView is one of our scrollView widgets.  If not, what is scrollView?

Oh…my bad! I thought i was doing it wrong and i deleted some things. This is how it was before…the page scrolls but my buttons don’t work.

module(…, package.seeall)

function new()    

    

    

    local localGroup = display.newGroup()        

    

    – change scene function

    function changeScene(e)

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

            director:changeScene(e.target.scene, “moveFromRight”);

        end

    end            

local function onSendSMS( event )

    – compose an SMS message (doesn’t support attachments)

    local options =

    {

       body = “https://itunes.apple.com/us/app/

    }

    native.showPopup(“sms”, options)

    

end

    

local widget = require “widget”

    

    – button back

–    local btn_back = display.newImageRect(“buton-back.png”, 108, 65 )

–        btn_back:setReferencePoint(display.CenterReferencePoint);

–        btn_back.x = _w/2-255;

–        btn_back.y = _h/2-440;

–        btn_back.scene = “welders1”;

–        btn_back:addEventListener(“touch”, changeScene);

        

    – fundal

–    local btn_bg = display.newImageRect(“BG-categorii.png”, 640, 780 )

–        btn_bg:setReferencePoint(display.CenterReferencePoint);

–        btn_bg.x = _w/2;

–        btn_bg.y = _h/2-11;

    – menu bar buttons

    local btn_homeicon = display.newImage(“Home-icon.png”)

        btn_homeicon:setReferencePoint(display.CenterReferencePoint);

        btn_homeicon.x = _w/2-239;

        btn_homeicon.y = _h/2+420;

        btn_homeicon.scene = “index”;

        btn_homeicon:addEventListener(“touch”, changeScene);

        

    local btn_inviteicon = display.newImage(“Invite-icon.png”)

        btn_inviteicon:setReferencePoint(display.CenterReferencePoint);

        btn_inviteicon.x = _w/2-74;

        btn_inviteicon.y = _h/2+420;

        btn_inviteicon:addEventListener(“touch”, onSendSMS);

        

    local btn_workersicon = display.newImage(“Workers-icon.png”)

        btn_workersicon:setReferencePoint(display.CenterReferencePoint);

        btn_workersicon.x = _w/2+83;

        btn_workersicon.y = _h/2+420;

        btn_workersicon.scene = “workers”;

        btn_workersicon:addEventListener(“touch”, changeScene);

        

    local btn_shareicon = display.newImage(“Share-icon.png”)

        btn_shareicon:setReferencePoint(display.CenterReferencePoint);

        btn_shareicon.x = _w/2+243;

        btn_shareicon.y = _h/2+420;

        btn_shareicon.scene = “share”;

        btn_shareicon:addEventListener(“touch”, changeScene);

    

-----Scroll----


local function scrollListener( event )

   local phase = event.phase

   print( phase )

   local direction = event.direction

   – If the scrollView has reached it’s scroll limit

   if ( event.limitReached ) then

      if ( “up” == direction ) then

         print( “Reached Top Limit” )

      elseif ( “down” == direction ) then

         print( “Reached Bottom Limit” )

      elseif ( “left” == direction ) then

         print( “Reached Left Limit” )

      elseif ( “right” == direction ) then

         print( “Reached Right Limit” )

      end

   end

   return true

end



local scrollView = widget.newScrollView

{

   left = 0,

   top = 80,

   width = 640,

   height = 770,

   maskFile = “mask2.png”,

   scrollWidth = 465,

   scrollHeight = 670,

   friction = 0.972,

   listener = scrollListener,

}


local background2 = display.newImageRect( “bb-Burcescu-Victor.png”, 585, 86 )

    background2.x = 315

    background2.y = 70

    background2.scene = “welders3”;

    background2:addEventListener(“touch”, changeScene); 

    scrollView:insert( background2 )

    

    

local background3 = display.newImageRect( “bb-Nicolae-Constantin.png”, 585, 86 )

    background3.x = 315

    background3.y = 170

    background3.scene = “welders3”;

    background3:addEventListener(“touch”, changeScene); 

    scrollView:insert( background3 )

    

local background3 = display.newImageRect( “bb-Nicolae-Constantin.png”, 585, 86 )

    background3.x = 315

    background3.y = 270

    background3.scene = “welders3”;

    background3:addEventListener(“touch”, changeScene); 

    scrollView:insert( background3 )

    

local background3 = display.newImageRect( “bb-Nicolae-Constantin.png”, 585, 86 )

    background3.x = 315

    background3.y = 370

    background3.scene = “welders3”;

    background3:addEventListener(“touch”, changeScene); 

    scrollView:insert( background3 )


bgImage2 = display.newImageRect( “bara-neagra.png”, 640, 92 )

bgImage2.x = 320; 

bgImage2.y = 46;



        

    — insert everything into the localGroup

–    localGroup:insert(rowTitle)

–    localGroup:insert(rowTitle2)

–    localGroup:insert(row)

–    localGroup:insert(btn_bg)

–    localGroup:insert(btn_back)

    localGroup:insert(btn_homeicon)

    localGroup:insert(btn_inviteicon)

    localGroup:insert(btn_workersicon)    

    localGroup:insert(btn_shareicon)

    localGroup:insert(btn_shareicon)

    localGroup:insert(scrollView)

    localGroup:insert(bgImage2)

    

    clean = function ()

    

    end

    

    return localGroup

    

end

Okay… Your scrollView is sitting on top of your buttons it appears.  Try inverting this:

    localGroup:insert(btn\_homeicon)     localGroup:insert(btn\_inviteicon)     localGroup:insert(btn\_workersicon)         localGroup:insert(btn\_shareicon)     localGroup:insert(btn\_shareicon)     localGroup:insert(scrollView)     localGroup:insert(bgImage2)

Thank’s for the quick answers but still no luck…i tried moving things in different ways but my buttons stil won’t work. 

Hmm, my message didn’t post correctly.

    localGroup:insert(bgImage2)     localGroup:insert(scrollView)       localGroup:insert(btn\_homeicon)     localGroup:insert(btn\_inviteicon)     localGroup:insert(btn\_workersicon)         localGroup:insert(btn\_shareicon)     localGroup:insert(btn\_shareicon)

Is that how you changed it?

I tried it like that and it only makes things scroll over my top bar and not under it…buttons still won’t work.

Where are you creating your scrollView? or including the widget library?

Sorry ! i don’t understand. :frowning:

You have this line of code:  

      scrollView :insert( background2 )

I don’t see where you ever create the scrollView object.  I also don’t see where you are doing:

      local widget = require(“widget”)

to include the widget library.  That is if your scrollView is one of our scrollView widgets.  If not, what is scrollView?

Oh…my bad! I thought i was doing it wrong and i deleted some things. This is how it was before…the page scrolls but my buttons don’t work.

module(…, package.seeall)

function new()    

    

    

    local localGroup = display.newGroup()        

    

    – change scene function

    function changeScene(e)

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

            director:changeScene(e.target.scene, “moveFromRight”);

        end

    end            

local function onSendSMS( event )

    – compose an SMS message (doesn’t support attachments)

    local options =

    {

       body = “https://itunes.apple.com/us/app/

    }

    native.showPopup(“sms”, options)

    

end

    

local widget = require “widget”

    

    – button back

–    local btn_back = display.newImageRect(“buton-back.png”, 108, 65 )

–        btn_back:setReferencePoint(display.CenterReferencePoint);

–        btn_back.x = _w/2-255;

–        btn_back.y = _h/2-440;

–        btn_back.scene = “welders1”;

–        btn_back:addEventListener(“touch”, changeScene);

        

    – fundal

–    local btn_bg = display.newImageRect(“BG-categorii.png”, 640, 780 )

–        btn_bg:setReferencePoint(display.CenterReferencePoint);

–        btn_bg.x = _w/2;

–        btn_bg.y = _h/2-11;

    – menu bar buttons

    local btn_homeicon = display.newImage(“Home-icon.png”)

        btn_homeicon:setReferencePoint(display.CenterReferencePoint);

        btn_homeicon.x = _w/2-239;

        btn_homeicon.y = _h/2+420;

        btn_homeicon.scene = “index”;

        btn_homeicon:addEventListener(“touch”, changeScene);

        

    local btn_inviteicon = display.newImage(“Invite-icon.png”)

        btn_inviteicon:setReferencePoint(display.CenterReferencePoint);

        btn_inviteicon.x = _w/2-74;

        btn_inviteicon.y = _h/2+420;

        btn_inviteicon:addEventListener(“touch”, onSendSMS);

        

    local btn_workersicon = display.newImage(“Workers-icon.png”)

        btn_workersicon:setReferencePoint(display.CenterReferencePoint);

        btn_workersicon.x = _w/2+83;

        btn_workersicon.y = _h/2+420;

        btn_workersicon.scene = “workers”;

        btn_workersicon:addEventListener(“touch”, changeScene);

        

    local btn_shareicon = display.newImage(“Share-icon.png”)

        btn_shareicon:setReferencePoint(display.CenterReferencePoint);

        btn_shareicon.x = _w/2+243;

        btn_shareicon.y = _h/2+420;

        btn_shareicon.scene = “share”;

        btn_shareicon:addEventListener(“touch”, changeScene);

    

-----Scroll----


local function scrollListener( event )

   local phase = event.phase

   print( phase )

   local direction = event.direction

   – If the scrollView has reached it’s scroll limit

   if ( event.limitReached ) then

      if ( “up” == direction ) then

         print( “Reached Top Limit” )

      elseif ( “down” == direction ) then

         print( “Reached Bottom Limit” )

      elseif ( “left” == direction ) then

         print( “Reached Left Limit” )

      elseif ( “right” == direction ) then

         print( “Reached Right Limit” )

      end

   end

   return true

end



local scrollView = widget.newScrollView

{

   left = 0,

   top = 80,

   width = 640,

   height = 770,

   maskFile = “mask2.png”,

   scrollWidth = 465,

   scrollHeight = 670,

   friction = 0.972,

   listener = scrollListener,

}


local background2 = display.newImageRect( “bb-Burcescu-Victor.png”, 585, 86 )

    background2.x = 315

    background2.y = 70

    background2.scene = “welders3”;

    background2:addEventListener(“touch”, changeScene); 

    scrollView:insert( background2 )

    

    

local background3 = display.newImageRect( “bb-Nicolae-Constantin.png”, 585, 86 )

    background3.x = 315

    background3.y = 170

    background3.scene = “welders3”;

    background3:addEventListener(“touch”, changeScene); 

    scrollView:insert( background3 )

    

local background3 = display.newImageRect( “bb-Nicolae-Constantin.png”, 585, 86 )

    background3.x = 315

    background3.y = 270

    background3.scene = “welders3”;

    background3:addEventListener(“touch”, changeScene); 

    scrollView:insert( background3 )

    

local background3 = display.newImageRect( “bb-Nicolae-Constantin.png”, 585, 86 )

    background3.x = 315

    background3.y = 370

    background3.scene = “welders3”;

    background3:addEventListener(“touch”, changeScene); 

    scrollView:insert( background3 )


bgImage2 = display.newImageRect( “bara-neagra.png”, 640, 92 )

bgImage2.x = 320; 

bgImage2.y = 46;



        

    — insert everything into the localGroup

–    localGroup:insert(rowTitle)

–    localGroup:insert(rowTitle2)

–    localGroup:insert(row)

–    localGroup:insert(btn_bg)

–    localGroup:insert(btn_back)

    localGroup:insert(btn_homeicon)

    localGroup:insert(btn_inviteicon)

    localGroup:insert(btn_workersicon)    

    localGroup:insert(btn_shareicon)

    localGroup:insert(btn_shareicon)

    localGroup:insert(scrollView)

    localGroup:insert(bgImage2)

    

    clean = function ()

    

    end

    

    return localGroup

    

end

Okay… Your scrollView is sitting on top of your buttons it appears.  Try inverting this:

    localGroup:insert(btn\_homeicon)     localGroup:insert(btn\_inviteicon)     localGroup:insert(btn\_workersicon)         localGroup:insert(btn\_shareicon)     localGroup:insert(btn\_shareicon)     localGroup:insert(scrollView)     localGroup:insert(bgImage2)

Thank’s for the quick answers but still no luck…i tried moving things in different ways but my buttons stil won’t work. 

Hmm, my message didn’t post correctly.

    localGroup:insert(bgImage2)     localGroup:insert(scrollView)       localGroup:insert(btn\_homeicon)     localGroup:insert(btn\_inviteicon)     localGroup:insert(btn\_workersicon)         localGroup:insert(btn\_shareicon)     localGroup:insert(btn\_shareicon)

Is that how you changed it?

I tried it like that and it only makes things scroll over my top bar and not under it…buttons still won’t work.