Resized images reverting to their original size

Jim Carwardine JimCarwardine at OwnYourFuture-net.com
Sat Nov 20 11:27:16 EST 2004


Thanks, Chipp.  I am just venting a little.  I think Rev is wonderful.  The
learning curve is long for some things.  Especially those things that didn't
have as many choices as with HyperCard... Jim

on 11/20/04 8:37 AM, Chipp Walters wrote:

> Jim Carwardine wrote:
> 
>> I'm sure that all the different ways to reference an image is needed and
>> used by a few deeply knowlegeable scriptors, however, what I went
> thru to do
>> something similar to what you are asking was nothing short of one big
>> work-around.
>> 
>> Rant coming... Why can't we have a statement that reads like this...
>> 
>>                   set the icon of button xxx proportional to image yyy
>> 
>> Which would then make a permanent change to the buttons icon property
> that
>> could only be altered by another deliberate action.  In addition, RR
> would
>> assume you want the image converted to png unless you specify jpg or
>> something else specifically in an image acquisition statement like import
>> snapshot , etc.
>> 
>> Jim
> 
> Jim, your asking to add yet another token to the already large library,
> thus making things more complicated, rather than less. You can easily
> change and 'set' the size of an image and apply it to a button using the
> handler below. Note, this code could be easily modified to do a lot
> more, including error-checking, auto-changing the size of a button, etc.
> 
> See esp the line:
> set the imagedata of last img to the imagedata of last img
> 
> 
> CREATE A NEW STACK
> CREATE A BLANK IMG NAMED "temp"
> CREATE A BUTTON "myButton" AND SET THE SCRIPT OF IT TO:
> 
> on mouseUp
> 
>  constant kImgWidth = 80
>  answer file "choose image:"
>  if it is empty then exit to top
> 
>  makeAndSetIcon it, "myButton"
> 
> end mouseUp
> 
> on makeAndSetIcon pImgFileName, pButtonName
> 
>  --> THIS HANDLER WILL SET THE ICON OF BTN pButtonName
>  --> TO THE FILE SPECIFIED BY pImgFileName
>  --> BE SURE TO HAVE AN IMG NAMED "temp" SOMEWHERE
>  --> ON THE CARD (MAY BE OFFSCREEN IF YOU LIKE)
> 
>  --> CHANGE kImgWidth TO CHANGE ICON SIZE
> 
>  constant kImgWidth = 80
> 
>  lock screen
>  clone image "temp"
>  set the lockLoc of last img to true
>  set the resizeQuality of last img to best
>  set the filename of last img to pImgFileName
>  set the width of last img to kImgWidth
>  put the formattedheight of last img into tH
>  put the formattedwidth of last img into tW
>  set the height of last img to kImgWidth/tW * tH
> 
>  --> THIS 'FREEZES' THE SIZE OF THE LAST IMG
>  set the imagedata of last img to the imagedata of last img
> 
>  set the icon of btn pButtonName to the id of last img
>  unlock screen
> 
> end makeAndSetIcon
> 
> and...
> 
>> on 11/19/04 3:55 PM, Mathewson wrote:
>> 
>> 
>>> Dear RR-ers,
>>> I find that if I import an image (GIF/JPG) into a RR
>>> stack that has multiple cards a resize problem:
>>> 
>>> e.g. I import an image of size 500 x 500 to card 1 and then
>>> send
>>> 
>>> set width of img "Richmond" to 200
>>> set height of img "Richmond" to 200
>>> 
>>> it resizes OK (unsurprising really!) - if I then go to the
>>> next card (Card 2) and then return (GO PREV) my image has
>>> reverted to 500 x 500:
>>> 
>>> BUMMER !
>>> 
>>> any advice????
> 
> 
> Hmmm.
> 
> Mathewson's problem can be fixed by adding a single statement after his
> two set width of img statements:
> 
> set the lockloc of img "Richmond" to true
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution

-- 

OYF is... Highly resourceful people working together.
<http://www.OwnYourFuture-net.com>

Own Your Future Consulting Services Limited,
1959 Upper Water Street, Suite 407, Halifax, Nova Scotia. B3J 3N2
Info Line: 902-823-2477, Phone: 902-823-2339. Fax: 902-823-2139





More information about the use-livecode mailing list