Copy link to clipboard
Copied
Hi there, some information I gleaned from discussions on the Indesign forum.
Might be good to have one thread where various issues are discussed in one place.
Keep in mind these issues being discussed over there are showing up in InDesign not After Effects.
I have not tested these, it's just stuff others are talking about - I have yet to fix my scripts for CC.
So if anybody has info... wishes to discuss....
What people are talking about:
- issues with creation properties - toggle
Copy link to clipboard
Copied
Another, just discovered 'mousemove' event listener is not being triggered.
Copy link to clipboard
Copied
For me - return key in edittext boxes not being picked up (enterKeySignalsOnChange) - It's just doing nothing.
Copy link to clipboard
Copied
Hi Alan, thanks for this list.
2 bugs I mentioned on the forum:
- 'click' and 'mouseup' events not being triggered: http://forums.adobe.com/message/5449261#5449261
- no Flash/Extendscript communication: http://forums.adobe.com/message/5483589
Copy link to clipboard
Copied
Damn - the mousemove event not being triggered means throwing a script in the bin for me!! yikes. Weeks of work down the drain if that's the case.
Copy link to clipboard
Copied
You may try to replace calls to addEventListener with a function, like
button.onClick instead of the 'click' event for example
Copy link to clipboard
Copied
Of course but that means that older script need to be updated even though nothing is wrong with them. Plus those events are documented in the CC Javascript Guide.
Copy link to clipboard
Copied
Thanks but there only seems to be a subset of events that can be tracked like this, mousemove isn't set up automatically - and unfortunately it's exactly what I need, there is no other substitute.... in this case anyway... thanks.
Copy link to clipboard
Copied
thought i was the only one!
apparently it works for some elements like 'StaticText' but not for others like 'DropDownList' 😕
Copy link to clipboard
Copied
Hi there Alan. Good thread.
Things I found:
Custom elements now require type:'customButton', else no onClick is called. Workaround is to to make it Button element or to add .addEventListener('click'...) instead of onClick;
TreeView totaly bugged. If you have onExpand or onCollapse, AE crashes randomly. In versions CS5, CS5.5 and CS6 it crashes only if you have nodes stacked in node element. The more lines of code you provide in the onCollapse or onExpand methods the more often it crashes - crashes after 30-50 clicks of the arrow button with only "$.writeln(node.expanded);" and after 3-4 clicks if you have 5 lines of logical code. Node expanded property always false (this seems to be the case for all AE versions after CS5). Setting it to true should open the node and false should close it as stated in the CS6 Guide, but it does not.
AE crashes after closing script palette. You can't reference ScriptUIBrush - myWindow.graphics.backgroundColor = myOtherWindow.graphics.backgroundColor. Workaround: myWindow.graphics.backgroundColor = myWindow.graphics.newBrush(...., myOtherWindow.graphics.backgroundColor.color ). This crashes AE on Windows and Mac, versions: CS5, CS5.5, CS6 (after closing the palette) and CC (on runtime)
Cheers,
Tony
Copy link to clipboard
Copied
The end of Peter Kahrel's pdf has an CC Script UI changes appendix. It's a bit vague - like our thread! but throws up some other stuff too. BTW Todd Kopriva responded to another thread there and said he would post the nuts and bolts of the changes soon.
Copy link to clipboard
Copied
Another thing I noticed about scripted buttons- You can't color them. In the past you could make a group or panel the same size as the button, and give it a background color. Then make the button right on top of that small panel, the same size, and the button would inherit the color. No more. )-: Weeks of my work down the tubes.
Also, somebody mentioned AE crashing when you close a script window. Strangely I had that in previous versions of AE, but not in CC. (I'm on Mac.)
Copy link to clipboard
Copied
If you want color you now need images. You'll face other issues.
http://forums.adobe.com/message/5447193#5447193
http://forums.adobe.com/message/5642864#5642864
Xavier
Copy link to clipboard
Copied
Also, I came across an issue in CC that was not ocurring in CS6. In CC, if you register an .onClick event handler on an EditText object, the handler never gets executed. On CS6 doing the same thing will execute the registered handler. I also noticed that access to font drawing in CC is unavailable.
I know there has to be a reason for all these changes. They seem, well, pretty drastic. . .
--Arie
Copy link to clipboard
Copied
A technique I am using now is using groups and setting up an onClick handler, the background colour goes say a different tone for a press. Then the text of the 'button' is just a statictext sitting in the group. So you would sacrifice the built in 3d look of buttons for colour. It's tidy enough without using external images and lengthy code.
Copy link to clipboard
Copied
Great idea, Alan. But I'm having trouble getting any kind of onClick to work for a group or panel. Do you have any sample code?
Copy link to clipboard
Copied
I will when at desk in the morning, at home now. That is pre- CC by the way - I think I could hazard a guess that it is yet another thing that does not work in CC!!
Copy link to clipboard
Copied
Hey Alan, I made it work a different way. (Still interested in knowing how you did it if it works in CC though.) This is what I did to make it work without an onClick on the group:
I made a group with a background color, then made static text on top of that group, just as you suggested. But then I simply made a button on top of the group, and added this:
myButton.onDraw = function(){
// Do nothing. Don't draw the button.
}
Even though the button isn't drawn, I can still put my onClick on that button.
(Also, note that the static text needs a "justify = 'center'" to center your text, which the button would have done automatically.)
You know, in the end, I actually like how this looks better than the 3D buttons. It's a much more "flat" interface look, which we know is all the rage with the kids these days.
Copy link to clipboard
Copied
Smart.
This makes pretty much everything accept click events.
Copy link to clipboard
Copied
function buttonTest(txt){
var win = new Window ("dialog","test",undefined);
win.graphics.foregroundColor= win.graphics.newPen(win.graphics.PenType.SOLID_COLOR, [.7, .7, .7], 1);
win.graphics.backgroundColor= win.graphics.newBrush(win.graphics.BrushType.SOLID_COLOR, [.2, .2, .2], 1);
//add group
var b = win.add("group");
b.graphics.backgroundColor= b.graphics.newBrush(b.graphics.BrushType.SOLID_COLOR, [.5, .5, .7], 1);
b.addEventListener ("click", function (m){handleMouseDown(m,b)});
//overlay text
var bText= b.add('statictext',undefined,txt);
bText.enabled=false;
bText.preferredSize.width=300;
var buttonClose = win.add("button",undefined,"Close"); buttonClose.preferredSize= [130,20];
buttonClose.onClick = function (){ this.parent.close();}//close the window.
// bText.onClick=function(){
//On click works in the ESTK on a group not in AFX - so using an event listener.
// this.parent.graphics.backgroundColor= this.parent.graphics.newBrush(this.parent.graphics.BrushType.SOLID_COLOR, [.1, .1, .8], 1);
// $.sleep(300);
// this.parent.graphics.backgroundColor= this.parent.graphics.newBrush(this.parent.graphics.BrushType.SOLID_COLOR, [.5, .5, .7], 1);
// }
//On click-------------------------------
function handleMouseDown(ev,theButton){
theButton.graphics.backgroundColor = theButton.graphics.newBrush(theButton.graphics.BrushType.SOLID_COLOR, [.9, .1, .1], 1);
}
//On click-------------------------------
//------------------------------
win.show();
}//close
buttonTest('Go on Click me...');
Copy link to clipboard
Copied
In reference to the above...
So the ESTK works fine with onClick but not in After Effects. -Using an event listener, so you could set up mouseover listeners etc also... and mouseout (or whatever they are called.)
Brilliant idea to not draw the button...!
Here I have disabled the edittext so the mouse pointer doesn't change into a cursor when hovering over the text...
So all this is not working in CC because of event listeners and changes in the scripting. . . so again, this is all pre-CC stuff.
The guys over on inDesign have a few more threads on custom buttons and physically drawing them based on length of strings etc. There is a link in the back of Peter Kahrel's pdf.
Copy link to clipboard
Copied
Thanks for the code specifics Alan. Bummer that it's pre-CC!
A thought that I haven't tried yet- I wonder if you could just get the mouseOver from the invisible button and make a function that changes the background color of the group.
Copy link to clipboard
Copied
Well I think that you would have to do an event listener for that anyway, so it would be the same deal.
Copy link to clipboard
Copied
I can confirm that in CC you can still addEventListener's to buttons. Even if the button is invisible with the onDraw trick.
So I'd guess that if you hooked up a mouse over listener to a function that changed the background color of the group, then you could change the color of your virtual button during a user's mouse over.
Copy link to clipboard
Copied
I made a group with a background color, then made static text on top of that group, just as you suggested. But then I simply made a button on top of the group, and added this:
myButton.onDraw = function(){
// Do nothing. Don't draw the button.
}
This is a really cool idea, can I ask how you stack control objects on top of each other to make this work?
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more