How do I import/read images and their ID from a separate folder to change the icon of a button?

William de Smet williamdesmet at
Mon Nov 28 12:00:17 EST 2011

Thanks for the info!
It's not quite working because it needs to happen 'invisible' so
'answer file'  is not what I need.
And then there is the random function as well.

Do you think it is possible to use "put the files into fld "pictures"
and then pick one at random?



2011/11/27 Björnke von Gierke <bvg at>:
> 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):
> on mouseUp
>  create image
>  put it into theImageID
>  create button
>  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
>  end if
> end mouseUP
> --
> Watch live presentations every Saturday:
> Use an alternative Dictionary viewer:
> Chat with other RunRev developers:
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

More information about the Use-livecode mailing list