Cached imagesource

J. Landman Gay jacque at hyperactivesw.com
Thu Jan 7 00:20:31 EST 2010


tsj wrote:
> What about setting the filename of an image object and setting the
> imagesource of the character to its id...
> 
> set the filename of image id 1005 to [somefilepath1]
> set the imagesource of char 1 of fld 1 to 1005
> set the filename of image id 1005 to [somefilepath2]
> set the imagesource of char 1 of fld 1 to 1005
> 
> ...seems to work

I think it works because the file name changes from somefilepath1 to 
somefilepath2, and both the image object and the imagesource are using 
the same file path referent. Actually, I'm using this method on the card 
where the user sets their image preference. And you're right, it works fine.

The issue comes in later when I need to use the image in a print 
template. This could be long after the preferences have been set and the 
app closed and relaunched. For that I need to read the image from disk, 
which works on the first print job (when Rev retrieves the file) but 
fails if the user changes the image in prefs and then does another print 
job (when Rev does not retrieve the file.) The old image shows up on the 
second printout. I suppose I could hide an image object on the print 
templates but I think I'll just store different file names on disk instead.

Mostly I was surprsied that the engine cached the image in the first 
place. I didn't know it did that, and I was debugging in all the wrong 
places.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list