image is shared between cards instead of unique to the cards
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
image is shared between cards instead of unique to the cards
I have a stack of about 50 cards with a number of fields and buttons shared in a group 'collection'. Each card has an image (png), belonging to the same group 'collection', that I load from the internet when the card is created. However, this image is shared between all cards instead of being unique to the card in question. How do I code it so that each card can have its own image? Do I miss a property of the image to be set?
-
- Livecode Opensource Backer
- Posts: 10076
- Joined: Fri Feb 19, 2010 10:17 am
Re: image is shared between cards instead of unique to the cards
If you want an image to be shared across a number of card you set it as a ckground image.
If you want each card to have its own images you don't do that.
As your collection of butons & so forth is shared across all your cards I assume that you have set that group as a background.
viewtopic.php?t=37407
If you want each card to have its own image then that image will have NOT to belong to your background group.
If you want each card to have its own images you don't do that.
As your collection of butons & so forth is shared across all your cards I assume that you have set that group as a background.
viewtopic.php?t=37407
If you want each card to have its own image then that image will have NOT to belong to your background group.
Re: image is shared between cards instead of unique to the cards
Thanks. When I look at the object properties of my group 'collection' I have checked 'shared group' and 'behave like a background'.
But how can I make the image to not belong to this background group?
But how can I make the image to not belong to this background group?
-
- Livecode Opensource Backer
- Posts: 10076
- Joined: Fri Feb 19, 2010 10:17 am
Re: image is shared between cards instead of unique to the cards
Just set a background for each card individually.
Re: image is shared between cards instead of unique to the cards
Sorry, but I don't get what you are saying.
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: image is shared between cards instead of unique to the cards
Put the image unique to each card on the card instead of the shared background.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: image is shared between cards instead of unique to the cards
Hi @Martin-HC
One option is to remove the image from the shared group and have one image on each card. Another option is to change the image filename to a different file in preOpenCard. For example:
Instead of using the filename property, you can use the imageData or text property and store the images on the stack. Something like this:
These are just some ideas on how you can reuse the image you're sharing within the shared group.
One option is to remove the image from the shared group and have one image on each card. Another option is to change the image filename to a different file in preOpenCard. For example:
Code: Select all
on preOpenCard
--
set the filename of image "theImage" to ("./images/" & the short name of this card)
--
end preOpenCard
Code: Select all
on preOpenCard
--
set the text of image "theImage" to the text of image (the short name of this card) of card "imagestore"
--
end preOpenCard
Be kind, we all have our own wars.
https://torocruzand.com/
https://torocruzand.com/
-
- Livecode Opensource Backer
- Posts: 10076
- Joined: Fri Feb 19, 2010 10:17 am
Re: image is shared between cards instead of unique to the cards
OK: Uncle Richmond puts his Primary School Teacher hat on . . .
I have made a new stack, and on the first card I have made a group containing 3 buttons and a field:
- -
I have set the 'Shared group' and the 'Behave like a background' to positive.
NOW, having done that, I shall choose a 'background' image for each card.
- -
I am NOT uploading my stack as its size exceeds the 256 KB (extremely mean) size for files allowed in these forums.
I have made a new stack, and on the first card I have made a group containing 3 buttons and a field:
- -
I have set the 'Shared group' and the 'Behave like a background' to positive.
NOW, having done that, I shall choose a 'background' image for each card.
- -
I am NOT uploading my stack as its size exceeds the 256 KB (extremely mean) size for files allowed in these forums.
Re: image is shared between cards instead of unique to the cards
Thanks to all who replied! Really appreciated it because the solution was indeed to drop the shared image and place an image on each card. Fortunately, that was easy to script. So now I have exactly what I want with a unique image on each card.
Now that the shared image issue has been resolved, I've been able to continue working on my stack all day today where I document my collection of LEGO Star Wars minifigures. I couldn't be happier
As a side note: as an old HC user I still struggle with the complicated concept of backgrounds/groups in LiveCode, which I think I will never understand.
Now that the shared image issue has been resolved, I've been able to continue working on my stack all day today where I document my collection of LEGO Star Wars minifigures. I couldn't be happier

As a side note: as an old HC user I still struggle with the complicated concept of backgrounds/groups in LiveCode, which I think I will never understand.

Re: image is shared between cards instead of unique to the cards
Hi.
It took me a while to migrate, in my thinking, from the HC background object to the LC group object. They are not at all the same, but the group can be coaxed into much the same functionality. All it takes is a bit of practice.
Craig
It took me a while to migrate, in my thinking, from the HC background object to the LC group object. They are not at all the same, but the group can be coaxed into much the same functionality. All it takes is a bit of practice.
Craig