Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Set ScriptUI dialog image to nothing?

Explorer ,
Apr 08, 2021 Apr 08, 2021

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.

TOPICS
Scripting

Views

80

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Apr 08, 2021 Apr 08, 2021
I'm not in a position to test it presently, but what about assigning an empty object, i.e. {}, or null.  

Likes

Translate

Translate
Advocate ,
Apr 08, 2021 Apr 08, 2021

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.  

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 08, 2021 Apr 08, 2021

Copy link to clipboard

Copied

LATEST

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!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines