Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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();
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
You need to create the images using the binary code first, then in ScriptUI.newImage() refer to the actual files.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
You need to create those at least inside some temporary folder otherwise it wouldn't work.
Copy link to clipboard
Copied
Thanks Alex
That's a good Idea!
Copy link to clipboard
Copied
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".
Copy link to clipboard
Copied
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!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now