Page 1 of 1

Image Scroller work in IOS but not in Android

Posted: Wed Oct 23, 2013 8:47 pm
by Kae
HI,this is a photo album that is need horizontal image scroller. However, I find some code that is work in IOS but not work in Android.
This is work in IOS ↓

Code: Select all

on preOpenCard
   if the environment is "mobile" then
      createScroller
   end if
end preOpenCard

on createScroller
   clearScroller "cardsScroller"
   
   set the unboundedHScroll of group "cards" to true
   
   iphoneControlCreate "scroller", "cardsScroller"
   iphoneControlSet "cardsScroller", "rect", "0,0,320,402"
   iphoneControlSet "cardsScroller", "contentRect", "0,0,1600,402"
   iphoneControlSet "cardsScroller", "visible", "true"
   iphoneControlSet "cardsScroller", "scrollingEnabled", "true"
   iphoneControlSet "cardsScroller", "pagingEnabled", "true"
   iphoneControlSet "cardsScroller", "canBounce", "true"
   iphoneControlSet "cardsScroller", "decelerationRate", "fast"
   iphoneControlSet "cardsScroller", "canCancelTouches", "true"
   iphoneControlSet "cardsScroller", "delayTouches", "true"
   iphoneControlSet "cardsScroller", "vIndicator", "false"
   iphoneControlSet "cardsScroller", "hIndicator", "false"
   iphoneControlSet "cardsScroller", "indicatorStyle", "black"
   iphoneControlSet "cardsScroller", "indicatorInsets", "0,0,0,0"
   iphoneControlSet "cardsScroller", "hscroll", 0
   iphoneControlSet "cardsScroller", "vscroll", 0

end createScroller

on scrollerDidScroll pX, pY
   if iPhoneControlTarget()  is "cardsScroller" then
      set the hScroll of group "cards" to pX
   end if
end scrollerDidScroll

on clearScroller pScrollerName
   if pScrollerName is among the lines of iphoneControls() then
      iphoneControlDelete pScrollerName
   end if
end clearScroller
Then, I change to ↓ for Android but not work.

Code: Select all

on preOpenCard
   if the environment is "mobile" then
      createScroller
   end if
end preOpenCard

on createScroller
   clearScroller "cardsScroller"
   
   set the unboundedHScroll of group "cards" to true
   
   mobileControlCreate "scroller", "cardsScroller"
   mobileControlSet "cardsScroller", "rect", "0,0,320,402"
   mobileControlSet "cardsScroller", "contentRect", "0,0,1600,402"
   mobileControlSet "cardsScroller", "visible", "true"
   mobileControlSet "cardsScroller", "scrollingEnabled", "true"
   mobileControlSet "cardsScroller", "pagingEnabled", "true"
   mobileControlSet "cardsScroller", "canBounce", "true"
   mobileControlSet "cardsScroller", "decelerationRate", "fast"
   mobileControlSet "cardsScroller", "canCancelTouches", "true"
   mobileControlSet "cardsScroller", "delayTouches", "true"
   mobileControlSet "cardsScroller", "vIndicator", "false"
   mobileControlSet "cardsScroller", "hIndicator", "false"
   mobileControlSet "cardsScroller", "indicatorStyle", "black"
   mobileControlSet "cardsScroller", "indicatorInsets", "0,0,0,0"
   mobileControlSet "cardsScroller", "hscroll", 0
   mobileControlSet "cardsScroller", "vscroll", 0

end createScroller

on scrollerDidScroll pX, pY
   if mobileControlTarget()  is "cardsScroller" then
      set the hScroll of group "cards" to pX
   end if
end scrollerDidScroll

on clearScroller pScrollerName
   if pScrollerName is among the lines of mobileControls() then
      mobileControlDelete pScrollerName
   end if
end clearScroller
Is there wrong in this code? Is there a good way to find out other code to replace? Or have another horizontal image scroller code is work in IOS and Android ?
I'm a bit under pressure here to get this Android version wrapped asap so I'd really appreciate any help. Thanks!

Re: Image Scroller work in IOS but not in Android

Posted: Wed Oct 23, 2013 9:12 pm
by Simon
Hi Kae,
You have iOS specific properties in the Android build.
e.g. canBounce is iOS only.

I'll let you go through all your properties to figure out which ones to remove from the Android code.

Simon

Re: Image Scroller work in IOS but not in Android

Posted: Thu Oct 24, 2013 5:25 pm
by Kae
Hi Simon,
I would like to know that am I just remove all about the canBounce functions? Or shall I replace it?
Also,is there any function is just used for IOS?
Thanks

Re: Image Scroller work in IOS but not in Android

Posted: Thu Oct 24, 2013 6:43 pm
by Simon
Hello Kae,
Please look up "mobileControlSet" in the dictionary.
All available properties are shown there.

Simon