ID:156596
 
I'm working on a button focus effect and this is how I'm updating the button on click.

var/F = fcopy_rsc(file("images\\asdf.png"))
winset(usr, "button1", "image=\ref[F]");


My concern here is that I don't know if I end up reusing asdf.png in the rsc file or not. I also don't know to what extent I'm communicating unnecessarily with the client in this case.

Should I setup global variables to hold a reference or is this method good enough? Perhaps there are other suggestions?

ts

Tsfreaks wrote:
I'm working on a button focus effect and this is how I'm updating the button on click.

> var/F = fcopy_rsc(file("images\\asdf.png"))
> winset(usr, "button1", "image=\ref[F]");
>


Assuming that you need dynamic image support (the contents of the images/ dir is in flux), this code looks fine. The fcopy_rsc() call will only perform the copy if the resource isn't already in the .rsc. You should be able to confirm this by looking at the size of your world.dyn.rsc file. Similarly, the resource will only be requested by the client if it doesn't have it in its own byond.rsc.
In response to Tom
Good news! Thank you.
ts