Page 1 of 1

HOW TO - Set image size

Posted: Wed May 15, 2013 11:04 pm
by palanolho
Greetings everyone.

I'm starting to give my first steps in livecode and i'm having a problem that I'm not being able to deal with (and its frustrating because its a BASIC thing....)

I have an image inside a group and I want to be able to change that image size by script. LEts say, with buttons to increase and decrease the size.

so, my image name is "play_area_bg" and i tried to do the following:

Code: Select all

on mouseUp
     set the width of image play_area_bg to 2000 px
     -- set the width of image play_area_bg to the width of image play_area_bg + 50
end mouseUp
None of this seems to work. the first strings gives me the erros "button "Button": execution error at line 2 (Chunk: no such object) near "play_area_bg", char 20"
the second string gives me the error "button "Button": execution error at line 3 (Chunk: no such object) near "play_area_bg", char 55"

I really don't understand way and i would like to understand :( It really seems a simple command... what am I doing wrong?


Thanks ins advance
- Miguel

Re: HOW TO - Set image size

Posted: Wed May 15, 2013 11:32 pm
by dunbarx
HI.

There is no native word "px" in LC, so lose that. Place your img reference in quotes:

set the width of image "play_area_bg" to 2000

That said, is the image on the same card as the button you are using to try to set the width? It looks like your script cannot find the image.

Both your lines seem OK, unless there is some hidden typo. Have you tried rewriting the line by hand?

Have you tried the command from the message box?

Craig Newman

Re: HOW TO - Set image size

Posted: Thu May 16, 2013 8:04 am
by palanolho
Greetings and thank you for your reply

As I said before, i'm starting to give my first steps :S. I don't really know how and for what can i use the command.

I just found what was the problem...

the problem is that i'm using an image as a background for a "rectangle" area and not a direct image...
I have changs the string to "set the width of graphic "play_area_bg" to 2000" and it worked fine (obviously lol)

It's difficult to remember everything you have done sins what we see is only the image...
The change size "problem" is done, thank you :)

- Miguel