ticked off, cStackRatio and cImageRatio Computation

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
slowdash
Posts: 24
Joined: Wed Feb 22, 2012 10:52 am

ticked off, cStackRatio and cImageRatio Computation

Post by slowdash » Wed Oct 10, 2012 2:06 am

ive been studying ticked off and i cant seem to figure out how to compute the custom properties for the imagese


cStackRatio and cImageRatio

anybody already done this or know a solution?

thanks in advance,
-Rye

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: ticked off, cStackRatio and cImageRatio Computation

Post by Klaus » Wed Oct 10, 2012 1:28 pm

Hi Rye,

I still have no idea what the "ticked off" example is, but this SOUNDS like this:
cStackRatio = stack width/stack height
cImageRatio = image width/image height

Correct?


Best

Klaus

slowdash
Posts: 24
Joined: Wed Feb 22, 2012 10:52 am

Re: ticked off, cStackRatio and cImageRatio Computation

Post by slowdash » Fri Oct 12, 2012 1:46 am

hi klaus,

thanks for responding, ticked off is the example in the livecode beginners course, it contains code located in the resources stack that
resizes images on resizeStack.

Code: Select all

on resizeImages
   put the mainstack of this stack into tMain
   put the width of stack tMain into tStackWidth
   put the height of stack tMain into tStackHeight
   
   repeat with x = 1 to the number of images of me
      put the short name of image x of me into tImageName
      
      put the cStackRatio of image tImageName of me into tStackRatio  
      put the cPrimaryDimension of image tImageName of me into tPrimaryDimension
      put the cImageRatio of image tImageName of me into tImageRatio  
      
      if tPrimaryDimension is "width" then
         set the width of image tImageName of me to (tStackWidth * tStackRatio)
         set the height of image tImageName of me to (the width of image tImageName of me / tImageRatio)
      else if tPrimaryDimension is "height" then
         set the height of image tImageName of me to (tStackHeight * tStackRatio)
         set the width of image tImageName of me to (the height of image tImageName of me * tImageRatio)
      end if
   end repeat
end resizeImages

cStackRatio, cPrimaryDimension and cImageRatio are custom properties set for each image in the resources substack

i want to know how they were computed as the livecode example video does not say how they were computed.

thanks

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: ticked off, cStackRatio and cImageRatio Computation

Post by Klaus » Fri Oct 12, 2012 12:13 pm

Hi Rye,

these videos are only available to users who have been attending that course, so I can't watch them.
But did you try my suggestion? I bet my assumption is correct! 8)


Best

Klaus

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: ticked off, cStackRatio and cImageRatio Computation

Post by jacque » Fri Oct 12, 2012 6:12 pm

I think they were computed manually and then stored as properties for later use. It's tedious but you only need to do it once. For each object you figure out the ratio of its size compared to the screen size in your base layout in the IDE. Then the script uses that ratio to calculate the display size based on the size of the mobile device screen.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply