I have been trying to create an IOS Native Scroller with remote content inside.
What I am doing is creating images (from http images), creating buttons and fields in a group called "scrollGroup"
and then create a Native IOS Scroller to scroll inside the group.
But Unfortunately I am way out of succeeding. So Need your help here is my code and I have also attached my sample file.
Thanks Folks....
Code: Select all
on preOpenCard
if environment() is not "mobile" then exit preOpenCard
set the width of the templateImage to 1
set the height of the templateImage to 1
set the left of the templateImage to 0
set the top of the templateImage to 23
create image "koko0" in group "scrollGroup"
set the width of the templateImage to 400
set the height of the templateImage to 545
set the left of the templateImage to 175
set the top of the templateImage to 23
create image "koko" in group "scrollGroup"
set the filename of image "koko" to "http://koraybirand.co.uk/kb_newsstand/0001_Main%20Portfolio_cover.jpg"
set the width of the templateField to 400
set the height of the templateField to 100
set the left of the templateField to 575 + (1024 * 0)
set the top of the templateField to 300
set the opaque of the templateField to false
set the selected of the templateField to false
set the locktext of the templateField to true
set the threeD of the templateField to false
set the borderwidth of the templateField to 0
set the textSize of the templateField to 24
set the textStyle of templateField to "bold" --"italic,bold"
set the text of the templateField to "Main Portfolio" --& return & "selected works from all portfolios"
create field "KOKO" in group "scrollGroup"
set the script of the templateButton to "on mouseUp" & cr & "beep" & cr & "end mouseUp"
set the width of the templateButton to 70
set the height of the templateButton to 20
set the left of the templateButton to 580 + (1024 * 0)
set the top of the templateButton to 335
set the label of the templateButton to "Download"
create button in group "scrollGroup"
---
set the width of the templateImage to 1
set the height of the templateImage to 1
set the left of the templateImage to 1024 *1
set the top of the templateImage to 23
create image "02" in group "scrollGroup"
set the width of the templateImage to 400
set the height of the templateImage to 545
set the left of the templateImage to (1024 *1) +175
set the top of the templateImage to 23
create image "koko2" in group "scrollGroup"
set the filename of image "koko2" to "http://koraybirand.co.uk/kb_newsstand/0002_Editorial%20Works_cover.jpg"
--set the focusable of the templateField to false
set the width of the templateField to 400
set the height of the templateField to 100
set the left of the templateField to 575 + (1024 * 1)
set the top of the templateField to 300
set the opaque of the templateField to false
set the selected of the templateField to false
set the locktext of the templateField to true
set the threeD of the templateField to false
set the borderwidth of the templateField to 0
set the textSize of the templateField to 24
set the textStyle of templateField to "bold" --"italic,bold"
set the text of the templateField to "Editorial Portfolio" --& return & "selected works from all portfolios"
create field "KOKO" in group "scrollGroup"
set the script of the templateButton to "on mouseUp" & cr & "beep" & cr & "end mouseUp"
set the width of the templateButton to 70
set the height of the templateButton to 20
set the left of the templateButton to 580 + (1024 * 1)
set the top of the templateButton to 335
set the label of the templateButton to "Download"
create button in group "scrollGroup"
---
set the width of the templateImage to 1
set the height of the templateImage to 1
set the left of the templateImage to 1024 *2
set the top of the templateImage to 23
create image "03" in group "scrollGroup"
set the width of the templateImage to 400
set the height of the templateImage to 545
set the left of the templateImage to (1024 *2) + 175
set the top of the templateImage to 23
create image "koko3" in group "scrollGroup"
set the filename of image "koko3" to "http://koraybirand.co.uk/kb_newsstand/0003_Advertisement%20Works_cover.jpg"
--set the focusable of the templateField to false
set the width of the templateField to 400
set the height of the templateField to 100
set the left of the templateField to 575 + (1024 * 2)
set the top of the templateField to 300
set the opaque of the templateField to false
set the selected of the templateField to false
set the locktext of the templateField to true
set the threeD of the templateField to false
set the borderwidth of the templateField to 0
set the textSize of the templateField to 24
set the textStyle of templateField to "bold" --"italic,bold"
set the text of the templateField to "Advertisement Portfolio" --& return & "selected works from all portfolios"
create field "KOKO" in group "scrollGroup"
set the script of the templateButton to "on mouseUp" & cr & "beep" & cr & "end mouseUp"
set the width of the templateButton to 70
set the height of the templateButton to 20
set the left of the templateButton to 580 + (1024 * 2)
set the top of the templateButton to 335
set the label of the templateButton to "Download"
create button in group "scrollGroup"
---
set the width of the templateImage to 1
set the height of the templateImage to 1
set the left of the templateImage to 1024 *3
set the top of the templateImage to 23
create image "04" in group "scrollGroup"
set the width of the templateImage to 400
set the height of the templateImage to 545
set the left of the templateImage to (1024 *3) + 175
set the top of the templateImage to 23
create image "koko4" in group "scrollGroup"
set the filename of image "koko4" to "http://koraybirand.co.uk/kb_newsstand/0004_Covers_cover.jpg"
--set the focusable of the templateField to false
set the width of the templateField to 400
set the height of the templateField to 100
set the left of the templateField to 575 + (1024 * 3)
set the top of the templateField to 300
set the opaque of the templateField to false
set the selected of the templateField to false
set the locktext of the templateField to true
set the threeD of the templateField to false
set the borderwidth of the templateField to 0
set the textSize of the templateField to 24
set the textStyle of templateField to "bold" --"italic,bold"
set the text of the templateField to "Recent Covers" --& return & "selected works from all portfolios"
create field "KOKO" in group "scrollGroup"
set the script of the templateButton to "on mouseUp" & cr & "beep" & cr & "end mouseUp"
set the width of the templateButton to 70
set the height of the templateButton to 20
set the left of the templateButton to 580 + (1024 * 3)
set the top of the templateButton to 335
set the label of the templateButton to "Download"
create button in group "scrollGroup"
--dummy
set the width of the templateImage to 1
set the height of the templateImage to 1
set the left of the templateImage to (1024 *3) + 1024
set the top of the templateImage to 23
create image "koko5" in group "scrollGroup"
----scroller
put the rect of group "scrollGroup" into fldRect
answer fldRect
set the unboundedVScroll of group "scrollGroup" to true
set the unboundedHScroll of group "scrollGroup" to true
iphoneControlCreate "scroller"
put the result into scrollid
iphoneControlSet scrollid, "rect", fldRect
iphoneControlSet scrollid, "contentRect", (0, 0, 1024*4, 574)
iphoneControlSet scrollid, "visible", true
iphoneControlSet scrollid, "canBounce", true
iphoneControlSet scrollid, "declerationRate", fast
iphoneControlSet scrollid, "scrollingEnabled", true
iphoneControlSet scrollid, "canScrollToTop",true
iphoneControlSet scrollid, "canCancelTouches",true
iphoneControlSet scrollid, "delayTouches", true
iphoneControlSet scrollid, "vIndicator", true
iphoneControlSet scrollid, "indicatorStyle", black
iphoneControlSet scrollid, "indicatorInsets", "0,0,5,0"
iphoneControlSet scrollid, "hscroll", 0
iphoneControlSet scrollid, "vscroll", 0
end preOpenCard
on closeCard
if environment() is not "mobile" then exit closeCard
iphoneControlDelete scrollid
end closeCard