FORUMS: list search recent posts

Script onDraw Button 'mouseup' not triggered

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Clifford Li
Script onDraw Button 'mouseup' not triggered
on May 25, 2017 at 6:35:11 am

Did anyone try to onDraw a icon button, and that 'mouseup' event not been trigger?

In my case, I don't want any border added on my button, so I am trying to use onDraw function.


here's my script:

b.onDraw = function (state) {
this.graphics.drawImage(this.image,0,0);
}

var mouseEventHandler = function(event) {
switch (event.type) {
case 'mouseover':
event.target.image = roll;
break;
case 'mousedown':
event.target.image = down;
break;
case 'mouseout':
event.target.image = norm;
break;
case 'mouseup':
event.target.image = roll;
break;
default:
event.target.image = norm;
}
event.target.notify("onDraw");
}

b.addEventListener('mouseover', mouseEventHandler, false);
b.addEventListener('mouseout', mouseEventHandler, false);
b.addEventListener('mousedown', mouseEventHandler, false);
b.addEventListener('mouseup', mouseEventHandler, false);



Its working fine for ''mouseover" and "mousedown", but not "mouseup".

And I found out its only problem in aftereffects, my button is work as expected in photoshop and extend script toolkit.

So, can anyone please help for solve this problem?


Return to posts index

Clifford Li
Re: Script onDraw Button 'mouseup' not triggered
on May 25, 2017 at 6:37:31 am

By the way, the button "mouseup", in work on left click...weird.


Return to posts index

Xavier Gomez
Re: Script onDraw Button 'mouseup' not triggered
on May 25, 2017 at 7:38:18 am

You can use a ui element of type 'customView' (the constructor name is : Custom)

myBtn = myContainer.add("customView");

or, within a resource string:

res = "group{...,\
myBtn : Custom{type: 'customView'},\
....
}";

They can be attached all sorts of mouse event listeners, nothing broken.
But i think that if instead you take the 'customButton' type, 'mouseup' and 'click' are also broken.

Xavier


Return to posts index


Clifford Li
Re: Script onDraw Button 'mouseup' not triggered
on May 25, 2017 at 8:21:06 am

Thank you very much :)


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]