Closed coyote963 closed 5 years ago
The obvious answer, probably wrong is if foo.png works and on.png doesn't then perhaps 'on.png' is not a good png or the path is wrong. There might be a console error message - press Alt-/ (or apple-/) which could help.
I have tried looking at the console, and there is no error message logged
on.png is displayed when the app is first run, and off.png is displayed when on.png is clicked the first time. The trouble is as soon as off.png is clicked again, the image disappears. So I believe the file paths should be correct
For my purposes, I had to do a workaround by making a duplicate of on.png - on (Copy).png and use that in place of the toggle image back to on.png.
I believe the error lies in the image "remembering" its initialized image path and it being cached somehow, but looking at the source code, I can't seem to understand it well, as well as the fact that there is c code (which I am unfamiliar with).
You may be running into the cache "feature". Images are cached so they aren't downloaded/reloaded. You can turn off caching with app.cache = false
at the top of your Shoes.app block.
Wow that fixed the issue! Thanks a lot!
I am trying to make a simple app that displays an image (say on.png) and upon clicking it replaces it with a different image (off.png) and clicking toggles this image.
The problem I am running into is that the image turns off correctly. When I click an off image, the image disappears entirely even though I have used the same path for the original image and the set image.
It is more mysterious that when I set the on state to something else entirely: suppose foo.png the toggling behavior works as intended
Can someone please explain what is the difference and how I can fix this bug? I really appreciate it.