Page 1 of 1
Image on card repeats
Posted: Tue Jan 01, 2013 4:13 am
by rleiman
Hi Everyone,
I added an image to a sub stack and referenced this image on a card and noticed that the images repeats several times.
Can you tell me what I need to do so there is only 1 image with no repeats?
Thanks.
Re: Image on card repeats
Posted: Tue Jan 01, 2013 11:11 am
by jmburnod
HI rleiman,
Where did you do the reference of the image ?
Your picture let me think you have used the backgroundpattern of the card and there is not an image object. Right ?
To add an image you can use:
Code: Select all
new image
set the filename of last image to MyPathImg
-- myPathImg is a valid path for a image file
or
Use the second way if you want paint the image
Best regards
Jean-Marc
Re: Image on card repeats
Posted: Tue Jan 01, 2013 5:24 pm
by Klaus
Hi rleiman,
how did you "reference" the image from the substack?
Looks like you set the background pattern of your card/stack to that image!
This way it will be "repeated" if there is still room in the card
To display the image only ONCE, create a button in the size of that image (no name, no border,
maybe even disabled) and set its ICON to the ID of that image.
Et voila: ONE representation of the image!
Best and a happy 2013
Klaus
Re: Image on card repeats
Posted: Tue Jan 01, 2013 10:00 pm
by rleiman
Thanks for the reply.
I will try that.

Re: Image on card repeats
Posted: Wed Jan 02, 2013 8:00 pm
by jacque
I agree with Klaus, it looks like you've set the backgroundPattern of either a card or the stack to use the image. LiveCode will tile the image if it is smaller than the card. If you don't want to add an additional button, you can just set the size of the image to the size of the card before the card is drawn.
Code: Select all
set the width of img "myImg" to the width of this cd
set the height of img "myImg" to the height of this cd
set the backgroundPattern of this cd to "myImg"
Generally you only need to do that on preOpenStack or preOpenCard if the stack can't be resized by the user. If it can be resized, then you'd do that in a resizeStack handler.
Re: Image on card repeats
Posted: Wed Jan 02, 2013 11:09 pm
by rleiman
Hi,
That's what I was looking for.
Yes, I was using the image as the background by referencing it's I'd from the image file in the substack.
Thanks so much for the help.
Re: Image on card repeats
Posted: Fri Jan 04, 2013 11:38 am
by rleiman
This will be my first app with LiveCode.
