Copy link to clipboard
Copied
Is it possible in ExtendScript to set a ScriptUI image object to nothing such that the image that is rendered in the dialog window will disappear? I already know how to set the image to different images but not how to "delete" it if I don't want an image to appear at all. I already looked around in the documentation but I couldn't see anything relevant.
Here's something similar to what I'm trying to go for.
var w = new Window("dialog")
var myImg = w.add("image", undefined, File("path/to/initialImg.jpg"));
// some callback function here {
myImg.image = "" // trying to set to nothing but get error: not a file
// }
w.show()
My current workaround is to set the image to a placeholder image that's just a black square. Better than not being able to change the image at all I suppose.
1 Correct answer
I'm not in a position to test it presently, but what about assigning an empty object, i.e. {}, or null.
Explore related tutorials & articles
Copy link to clipboard
Copied
I'm not in a position to test it presently, but what about assigning an empty object, i.e. {}, or null.
Copy link to clipboard
Copied
This worked thank you. I don't know why I didn't think to do this. Setting to null gave an error but setting to {} worked.
myImg.image = {}
Ironically setting it to an empty object caused my Image.prototype.onDraw() method to crash internally without giving an error which therefore made the image disappear from the dialog. I just handled that by adding in a if check and a return statement just to be safe and everything works perfectly. Thanks for the help!

