Page 1 of 1

Mobile- button scroll

Posted: Fri Feb 21, 2014 12:43 pm
by saviour
Hi there,

I want to have scrolling buttons over a card for a mobile application. With referring to Native Scroller lesson, I created a group of buttons "button".
Now, what variation of below script needs to be put on the parent card so I can have scrolling button??

local sScrollerID

on preOpenCard
local tScrollerRect, tContentRect

// Only create a scroller on a mobile device
if environment() is not "mobile" then exit preOpenCard

// Set the area of the scroller
put the rect of group "button" into tScrollerRect

// Set the are of the content to be scrolled
put the left of field "lorem",the top of field "lorem",the right of field "lorem",the formattedHeight of field "lorem" into tContentRect

// Create the scroller control
mobileControlCreate "scroller", "loremScroll"
put the result into sScrollerID

// Set the properties of the scroller
mobileControlSet "loremScroll", "rect", tScrollerRect
mobileControlSet "loremScroll", "contentRect", tContentRect
mobileControlSet "loremScroll", "visible", true
mobileControlSet "loremScroll", "scrollingEnabled", true
mobileControlSet "loremScroll", "vIndicator", true
mobileControlSet "loremScroll", "vscroll", 0
end preOpenCard

on scrollerDidScroll hOffset, vOffset
// When the user scrolls move the displayed content
set the vScroll of group "scrollArea" to vOffset
end scrollerDidScroll

Please help.

Re: Mobile- button scroll

Posted: Fri Feb 21, 2014 3:53 pm
by Dixie
Hi..

Have a look at the attached stack... it allows you to create buttons in a group 'setgroup' that will scroll. All the handlers are in the stack script.
Hope it helps...

Re: Mobile- button scroll

Posted: Sat Feb 22, 2014 6:20 pm
by saviour
Thanks... I will try it out!!!