Resize Images sent to Substack

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
William Jamieson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 212
Joined: Fri Feb 01, 2013 1:31 am
Contact:

Resize Images sent to Substack

Post by William Jamieson » Sun May 25, 2014 6:58 pm

Hello. I got a fairly basic question regarding the resizing of images as done per the intro to Livecode tutorial when making the task list. Here is what I did.

I made a substack named "resources"
Made a card "images"

on the preopenstack handler of the main stack i have the line

send "resizeImages" to card "images" of stack "resources"

on the card script I have the following code

Code: Select all

on resizeImages
   put the height of stack "Med Engagement" into tHeight
   put the width of stack "Med Engagement" into tWidth
   set the height of image "arrowSmall" of me to 0.09 * tHeight
   set the width of image "arrowSmall" of me to 0.16* tWidth
   set the height of image "Splash Screen 1.jpg" of me to tHeight
   set the width of image "Splash Screen 1.jpg" of me to tWidth
   
      set the width of img "searchButton.png" of me to 0.18 * tWidth
   set the height of img "searchButton.png" of me to 0.09 * tHeight
   set the width of img "myMeds.png" of me to 0.16 * tWidth
   set the height of img "myMeds.png" of me to 0.08 * tHeight
   set the width of img "menuButton.png" of me to 0.16 * tWidth
   set the height of img "menuButton.png" of me to 0.07 * tHeight
   set the width of img "docButton.png" of me to 0.17 * tWidth
   set the height of img "docButton.png" of me to 0.07 * tHeight
   set the width of img "backButton.png" of me to 0.17 * tWidth
   set the height of img "backButton.png" of me to 0.08 * tHeight

   
end resizeImages
Now this code works fine and the images will resize. It works for only one card however. As soon as I change the card on the main stack such as [go to card "menu" of this stack] all the images in stack "resources" return to their original size. There are no other handlers that resize images.

What can I do to keep the images resized rather than having to execute the "resizeImages" handler on every card?

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

Re: Resize Images sent to Substack

Post by Klaus » Sun May 25, 2014 7:01 pm

Hi William,

set the "lockloc" of the image(s) to true!


Best

Klaus

William Jamieson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 212
Joined: Fri Feb 01, 2013 1:31 am
Contact:

Re: Resize Images sent to Substack

Post by William Jamieson » Mon May 26, 2014 6:36 pm

Hi Klaus!

Thank you for helping me out. have been livecoding for about a year now and I have never in any of my projects needed to lock the images. Yes, you are right, I almost forgot about that property. You saved the day once again Klaus. But it seems as though something is critically different with the new version of Livecode. I dont know if this is a work around to a problem, or if I just got lucky that it worked in the past.... hmmm...

Thank you once again, that should work. Ill test it out and if I dont post back, consider it solved.

-Will

Post Reply