How do I import/read images and their ID from a separate folder to change the icon of a button?
Björnke von Gierke
bvg at mac.com
Sun Nov 27 17:40:34 EST 2011
On 27 Nov 2011, at 15:38, William de Smet wrote:
> Eventually I will need a lot of images and now I was thinking of
> keeping the images outside of the stack in a separate folder.
> Is it possible to do the same thing? Read the images and their ID and
> set the icon of the button to the ID of an image.
Not exactly like that, but you can create image objects that only reference an stored image somewhere, by setting it's fileName. So you could have a button that references an id of an existing image object, which in turn references an image on your hard disk. I suggest to look up the fileName dictionary entry, barring that, here's an example (untested):
put it into theImageID
put it into theButtonID
set the icon of button ID theButtonID to theImageID
answer file ""
if it <> "" then
set the fileName of image ID theImageID to it
Watch live presentations every Saturday:
Use an alternative Dictionary viewer:
Chat with other RunRev developers:
More information about the Use-livecode