Page 1 of 1
Set background image of stack
Posted: Thu Jun 12, 2014 3:25 am
by shawnblc
I'm trying to do this of which neither work. Obviously, I'm not doing it quite right

Any help is very much appreciated. Just more practicing.
Code: Select all
set the backgroundImage of this stack to "http://domain.com/image.jpg"
Also tried this:
Code: Select all
put url "http://domain.com/image.jpg" into tImage
set the backgroundImage of this stack to tImage
Re: Set background image of stack
Posted: Thu Jun 12, 2014 4:01 am
by FourthWorld
Searching the Dictionary for "backgroundImage" turned up empty, but along the way I found "backgroundPattern" which may be what you're looking for.
Re: Set background image of stack
Posted: Thu Jun 12, 2014 4:28 am
by shawnblc
Found this that helped.
http://lessons.runrev.com/m/4603/l/44144-using-images
Not exactly how I wanted to do it, but it'll work.
Richard, thanks for the post, but I couldn't get it to work.
Re: Set background image of stack
Posted: Thu Jun 12, 2014 4:37 am
by sefrojones
Are you familiar with a groups ability to "Behave like a background"?
Re: Set background image of stack
Posted: Thu Jun 12, 2014 4:50 am
by shawnblc
sefrojonesGAda40 wrote:Are you familiar with a groups ability to "Behave like a background"?
I've read about it in the paste, but haven't yet made a stack to try it out. Any advice or tips appreciated.
In my spare time I try and learn as much as I can. Wish I could spend more time with LC though.
Re: Set background image of stack
Posted: Thu Jun 12, 2014 5:20 am
by sefrojones
So I made this example of background groups. First, I made all the controls and grouped them. I then opened the property inspector for that group and checked "Behave like a background" Then I put the script at the stack level. The stack starts with only 1 card, but as you add new cards you can see that the controls in the group that is behaving like a background are available on every new card. I also put a button to change the image, the command is in the stack script. It doesn't handle any re-sizing or anything, but as you change the background image, it will be changed on every card. Sorry if this isn't the clearest explanation, but hopefully this helps. From your original post it seems like you wanted to load a background image from URL, I think this example might do that.....
--Sefro
edit: I just re-uploaded the stack with a useless line removed....
Re: Set background image of stack
Posted: Thu Jun 12, 2014 5:22 am
by shawnblc
Thanks I'll check it out.
Re: Set background image of stack
Posted: Thu Jun 12, 2014 5:27 am
by bn
Hi Shawn,
to use a BackgroundPattern do like this:
try this in a new stack with one image (just drag an image object onto the card), hide the image, and one button with this script
Code: Select all
on mouseUp
put "http://runrev.com/wp-content/uploads/2013/04/Gracemount-Girls-LiveCoding-slim.jpg" into tPath
put url (tPath) into tImage
put tImage into image 1
set the backgroundPattern of this card to the short id of image 1
end mouseUp
It should give you a backgroundPattern with this image.
Now that image is rather large and you will only the topLeft part of the image, enlarge the stack to see more of the image.
You will notice that the image will repeat itself since it is a "pattern" So if you want to fill the background of your card you will have to either enlarge the image in case it is to small or adapt the size of your stack to the image. Or choose an image that fits your card etc.
Kind regards
Bernd
Re: Set background image of stack
Posted: Thu Jun 12, 2014 1:43 pm
by [-hh]
..........