Image Scroller work in IOS but not in Android

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Kae
Posts: 7
Joined: Thu May 09, 2013 4:46 am

Image Scroller work in IOS but not in Android

Post by Kae » Wed Oct 23, 2013 8:47 pm

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!

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Image Scroller work in IOS but not in Android

Post by Simon » Wed Oct 23, 2013 9:12 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Kae
Posts: 7
Joined: Thu May 09, 2013 4:46 am

Re: Image Scroller work in IOS but not in Android

Post by Kae » Thu Oct 24, 2013 5:25 pm

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Image Scroller work in IOS but not in Android

Post by Simon » Thu Oct 24, 2013 6:43 pm

Hello Kae,
Please look up "mobileControlSet" in the dictionary.
All available properties are shown there.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply