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

ScriptUI.newImage() rollover does not seem to work

Participant ,
Jul 05, 2018 Jul 05, 2018

Hi

I'm trying to make rollover in newImage() to work but no success yet.

The main image is loaded just fine, but the image set for a rollover event does not load up when the mouse passes over the IconButton;

using this line code:

myPanel.grp.clearGroup.myButton.image = ScriptUI.newImage(IconClean,IconClean,IconClean,IconCleanHover);

IconClean is the main image and IconCleanHover is the rollover image.

both are loaded as binary string.

any ideas?

thanks

Liran

TOPICS
Scripting
2.3K
Translate
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
Enthusiast ,
Jul 05, 2018 Jul 05, 2018

Icons have to be represented as File Object.

Here is the example:

var dir = "/d/scriptui/fig/";

var icons = {a: File(dir+"icon-a.png"), b: File(dir+"icon-b.png"),

c: File(dir+"icon-c.png"), d: File(dir+"icon-d.png")}

var w = new Window("dialog");

b = w.add ("iconbutton", undefined, ScriptUI.newImage (icons.a, icons.b, icons.c, icons.d));

w.show();

Translate
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
Participant ,
Jul 05, 2018 Jul 05, 2018

Thanks for your reply Alex!

My images are Binary so when I use them as files, I get an error trying this method:

var IconClean="\u0089P..."

var IconCleanHover="\u0089PNG\r\n\x1..."

var IconCleanFile = File(IconClean);

var IconCleanHoverFile = File(IconCleanHover);

myPanel.grp.clearGroup.myButton.image = ScriptUI.newImage(IconCleanFile,IconCleanFile,IconCleanFile,IconCleanHover);

is there a way to do this for Binary's?

Translate
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
Enthusiast ,
Jul 05, 2018 Jul 05, 2018

You need to create the images using the binary code first, then in ScriptUI.newImage() refer to the actual files.

Translate
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
Participant ,
Jul 05, 2018 Jul 05, 2018

Thanks again for your reply

I did that in the beginning:

var IconClean="\u0089P..." //Binary image

var IconCleanHover="\u0089PNG\r\n\x1..." //Binary image

myPanel.grp.clearGroup.myButton.image = ScriptUI.newImage(IconClean,IconClean,IconClean,IconCleanHover);

maybe it's because i'm using a panel and not a window?

Translate
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
Advocate ,
Jul 12, 2018 Jul 12, 2018

You need to same binary images to files first - having them in binary strings will not work when switching images. That's a limitation.

So Save binary images to files, and then point to physical files. This will work.

Translate
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
Participant ,
Jul 12, 2018 Jul 12, 2018

Hi Thomas

Thank you for your answer.

My goal was to create a single script file that not rely on external image files.

I guess the the way around this limitation is to create an event listener.

cheers!

Translate
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
Enthusiast ,
Jul 12, 2018 Jul 12, 2018

You need to create those at least inside some temporary folder otherwise it wouldn't work.

Translate
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
Participant ,
Jul 13, 2018 Jul 13, 2018

Thanks Alex

That's a good Idea!

Translate
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
Participant ,
Aug 06, 2018 Aug 06, 2018
LATEST

Hey Liran,

Have you found a solution?

I tried the addeventListener it works on the first time with the "mouseover", but it does not respond to the "mouseout".

Translate
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
Participant ,
Aug 06, 2018 Aug 06, 2018

I have the same problem.

However, there is a problem creating this folder if the user does not have administrative permissions to run the script. Is there any way to create Folders without requiring the user to run After Effects as Admin ??

Thanks!

Translate
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