Geoff:

Yes, importing one or a few images and then using them on many buttons works
great. You can even resize the images behind the scenes before opening the
cards:

1) Make a stack, import one copy of all the images you would need anywhere
(in this case that stack is called "alphabet")

2) use this handler to set a userProp for each image which is it's original
size expressed not as a rect (which is assumes a given loc) but only as
width,height (could be anywhere)

on mouseUp
  repeat with x = 1 to 72
    put the width of image x into tWidth
    put the height of image x into tHeight
    set mySize of image x to tWidth & "," & tHeight
  end repeat
end mouseUp

3) In your stack script put:

on resizeImage theRatio theImage
       # where theRatio is the size of the image in any instance
  set the defaultStack to "alphabet"
          # this would be your stack with imported images
  set the width of image id theImage to theRatio * item 1 of the mySize of
image id  theImage
  set the height of image id theImage to theRatio * item 2 of the   mySize
of image id  theImage
end resizeImage

on restoreImageSize theImage
  set the defaultStack to "alphabet"
  set the width of image id  theImage to  item 1 of the mySize of image id
theImage
  set the height of image id  theImage to  item 2 of the mySize of image id
theImage
end restoreImageSize

4) Now in any given context/card apply those image id's to buttons in you
main stack, I set the id's of all my images to 2000 plus whatever in number
order (in this case an alphabet) and  then let's say you want your
images/buttons on a given card to be small, in this case, only 17 percent of
the original, then do this:

on preopenCard
  repeat with x = 1 to 18
    resizeImage .17,  (2000+x)
  end repeat
end preopenCard

on closeCard
  repeat with x = 1 to 18
    restoreimagesize  (2000+x)
  end repeat
         # you must do this to make sure you are resize from a baseline size
end closeCard

with the above strategy, I produced a small app that is only 170 K that in
Supercard would have been close to over 1 meg to display the same images
over the same number of instances. incredible.

Hinduism Today

Sivakatirswami
Editor's Assistant/Production Manager
www.HinduismToday.com
[EMAIL PROTECTED]


Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to