Taking advantage of the orientation of the device

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
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Taking advantage of the orientation of the device

Post by Mag » Tue Dec 10, 2013 2:36 pm

Hi all,

I'm trying to adapt an image to take advantage of the new orientation of the device. This code works fine, but in portrait mode it crops the image at the left and right side. Any suggestion to improve it? :oops:

Code: Select all

on adaptImage
   set the width of image myImage to the width of this card
   put (formattedWidth of image myImage/the width of image myImage) into myFactor
   set the height of image myImage to (the the formattedHeight of image myImage/myFactor)
   
   set the loc of image myImage to the loc of this card
end adaptImage

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

Re: Taking advantage of the orientation of the device

Post by Simon » Wed Dec 11, 2013 12:02 am

Hi Mag,
Doubt this is the problem but you have a repeated word:
to (the the formattedHeight

A
bird
in the
the hand

That's some kind of optical illusion.

What happens if you stop the code right after;
set the width of image myImage to the width of this card
Does that do it's job correctly?

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

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: Taking advantage of the orientation of the device

Post by Mag » Sat Dec 14, 2013 2:02 pm

Thank you Simon. Sorry, it is an error I done in the simplified version of the code I made for the forum :oops:

Post Reply