Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Script onDraw Button ‘mouseup’ not triggered

  • Script onDraw Button ‘mouseup’ not triggered

    Posted by Clifford Li on May 25, 2017 at 6:35 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?

    Clifford Li replied 8 years, 11 months ago 2 Members · 3 Replies
  • 3 Replies
  • Clifford Li

    May 25, 2017 at 6:37 am

    By the way, the button “mouseup”, in work on left click…weird.

  • Xavier Gomez

    May 25, 2017 at 7:38 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

  • Clifford Li

    May 25, 2017 at 8:21 am

    Thank you very much 🙂

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy