Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Mouseover on palette

  • Mouseover on palette

    Posted by Jakob Wagner on September 24, 2016 at 12:15 pm

    Hi

    I have build a palette and I want it to update when mouse over the window. I do it like this:

    pal = new Window("palette", "name", undefined, {resizeable:false});

    pal.addEventListener("mouseover", mouseoverHandler);
    function mouseoverHandler()
    {
    alert("over");
    }

    The event fires when I mouse over the window, but it also fires when I roll over anything inside (childs to) the palette.
    Is there any way to make the mouseover only fire once when you roll over the window? Alternatively, any other way to get the palette to update with out the use of an update button?

    Thanks,
    Jakob

    Xavier Gomez replied 9 years, 6 months ago 2 Members · 8 Replies
  • 8 Replies
  • Xavier Gomez

    September 24, 2016 at 1:50 pm

    Hi Jacob,

    I tried your idea on Windows7 , CC2014, and the event does not trigger.
    Only when a child is added, it does trigger, but on the child, not the window itself.

    It’s pretty cool idea though, given that .onActivate does not work for dockable panels.
    I tried it on a dockable panel instead of a palette, and it seems to work, but again might be version dependant (AE or OS).
    This is the code i used:


    pal = this instanceof Panel ? this : new Window("palette", "name", undefined, {resizeable:false});

    pal.add("button{text: 'button 1'}");
    pal.add("button{text: 'button 2'}");
    pal.add("button{text: 'button 3'}");

    pal.addEventListener("mouseover", mouseoverHandler);
    function mouseoverHandler(ev){
    if (!ev.view.parent){
    this.children[1].enabled = !this.children[1].enabled;
    };
    };
    pal instanceof Window ? pal.show() : pal.layout.layout(true);

    (i removed the alert and changed it to something softer, otherwise the event never stops triggering).

    Event stuff is ancient Egyptian for me, but this should be roughly true:
    Inside the event, ‘this’ is the graphic element the listener was attached to (the window or panel).
    ev.view is the graphic element that triggers the event.
    So: !ev.view.parent means that the graphic element that triggered the event is a top level container.

    Xavier

  • Jakob Wagner

    September 24, 2016 at 2:54 pm

    Xavier, THANK YOU! It works perfectly. 🙂
    I really appreciate it.

  • Xavier Gomez

    September 24, 2016 at 3:03 pm

    Which system / AE version do you use to get it to work on a floating palette ?

  • Jakob Wagner

    September 24, 2016 at 5:32 pm

    I’m working on OSX and the newest version of AE. Once the plugin is done, I’ll be testing it on different systems/versions.

    So for you on windows 7 the code you wrote, didn’t work?

  • Xavier Gomez

    September 24, 2016 at 8:27 pm

    Not for floating palettes.

  • Jakob Wagner

    October 16, 2016 at 12:01 pm

    I have tested it out now on different systems. I’m using a dockable pallette like in your script.
    It works fine on OSX. It works on win10 for the newest AE. But it does not work on windows10 and cs6. It seems like you said, the event only triggers when mouseover an item in the window not on the window it self.

    Any ideas?

  • Jakob Wagner

    October 16, 2016 at 12:22 pm

    Only if you have a quick idea, otherwise don’t worry about it. It will just have to update on each item roll over in cs6.

  • Xavier Gomez

    October 16, 2016 at 3:57 pm

    No.
    No idea ?
    Just so you know, i had tested on Windows 7, AE CC 2014.3

    Xavier

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