• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

251

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

Guide , 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.  

Votes

Translate

Translate
Adobe
Guide ,
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.  

Votes

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!

Votes

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