The native scroller callbacks don't work for browser
Posted: Tue Jul 24, 2012 7:53 pm
I've added a native browser control. and all is fine.
The image loads and all is fine.
Except that the scroll callback don't work.
Is there any trick to this? Or do they just not work for the browser control?
on preOpenCard
--global mScrollerId
--iphoneControlCreate "browser"
send "makeControl" to group "Browser"
--put the result into sBrowserId
put gTempId into sBrowserId
iphoneControlSet sBrowserId, "visible", "true"
iphoneControlSet sBrowserId, "canBounce", "true"
iphoneControlSet sBrowserId, "autoFit", true
iphoneControlSet sBrowserId, "pageEnabled",true
--tpagingEnabled
iphoneControlSet sBrowserId, "rect", the rect of group "Browser"
--(the left of this card , the top of this card, the right of this card , the bottom of this card )
iphoneControlSet sBrowserId, "contentRect", (0,0,1000,1000)
loadImage
end preOpenCard
on scrollerDidScroll pOffsetX, pOffsetY
answer "yes" && pOffsetx && pOffsetY
if pOffsetX > 20 then
doAction "Retreat"
else if pOffsetX < -20 then
doAction "Advance"
end if
end scrollerDidScroll
on scrollerBeginDrag
answer "yes"
end scrollerBeginDrag
on loadImage
local localURL,imageNum
put the activeImage of card "View" into imageNum
put specialFolderPath("Documents") & "/image" &imageNum&".jpg" into localURL
replace " " with "%20" in localURL
iphoneControlSet sBrowserId, "url", "file://" & localURL
end loadImage
The image loads and all is fine.
Except that the scroll callback don't work.
Is there any trick to this? Or do they just not work for the browser control?
on preOpenCard
--global mScrollerId
--iphoneControlCreate "browser"
send "makeControl" to group "Browser"
--put the result into sBrowserId
put gTempId into sBrowserId
iphoneControlSet sBrowserId, "visible", "true"
iphoneControlSet sBrowserId, "canBounce", "true"
iphoneControlSet sBrowserId, "autoFit", true
iphoneControlSet sBrowserId, "pageEnabled",true
--tpagingEnabled
iphoneControlSet sBrowserId, "rect", the rect of group "Browser"
--(the left of this card , the top of this card, the right of this card , the bottom of this card )
iphoneControlSet sBrowserId, "contentRect", (0,0,1000,1000)
loadImage
end preOpenCard
on scrollerDidScroll pOffsetX, pOffsetY
answer "yes" && pOffsetx && pOffsetY
if pOffsetX > 20 then
doAction "Retreat"
else if pOffsetX < -20 then
doAction "Advance"
end if
end scrollerDidScroll
on scrollerBeginDrag
answer "yes"
end scrollerBeginDrag
on loadImage
local localURL,imageNum
put the activeImage of card "View" into imageNum
put specialFolderPath("Documents") & "/image" &imageNum&".jpg" into localURL
replace " " with "%20" in localURL
iphoneControlSet sBrowserId, "url", "file://" & localURL
end loadImage