Mouse Click
  • JeromeErasmusJeromeErasmus October 2011

    Hi, excellent work on the xJSFL code guys!. loving it...

    Just a thought.  I have noticed that a mouse down and mouse up event would be the best tool you could have for WindowSWF's many JSFL programmers have to use nasty enterframe loops and other things to get feedback into the WindowSWF.

    This does not have to include the elment that was clicked etc... Just an Event dispached so that the WindowSWF can call JSFL to get what element is selected.

    When do you think you would add this feature to the event classes you already have.


    keep it up. well done

  • DaveDave October 2011

    Hey Jerome,

    Hmm... can you expand on that?

    There's something similar I'm using at the moment that's not committed for deteting document, timeline, layer and frame selections (as JSFL events are unfortunately totally unreliable!), but I'm not sure if I totally understand what you're looking for with the mouse down and up.

    Thanks also for the kind feedback! There's been a bit of a delay in getting the Beta out - it's now ready, but unfortunately I've been swamped with work so need to find the time to make a proper release and update the docs.



  • JeromeErasmusJeromeErasmus November 2011


    Currently with JSFL you can add an event listener. e.g

    fl.addEventListener("documentClosed", myFunction);


    What I am suggesting, since you have an xJSFL.dll probably written with c/c++ is to include a mouse click event from the system. This event recieved from the system would be caught by the .dll and any JSFL / xJSFL would be able to register with the dispatcher in the .dll

    Now this would mean that the dll would have to persist an object in memory (i think and may be another way) and stay alive for the duration of the flash IDE session.


    Hope that helps

  • JeromeErasmusJeromeErasmus November 2011

    Oh, by the way are you using c or c++?

  • DaveDave November 2011

    That's not a bad idea!

    Actually the xJSFL dll is way simpler than that. It's basically a hijacked version of the sample dll - its only purpose is to serve as a persistent top-level namespace right now.

    I'll have a word with the only C person I know... unless that's your thing and you want to lend a hand!?

  • NardoNardo November 2012

    Hmmm... I don't know if it is in the good topic (I don't speak C/C++)

    playing with I've tried this to retrieve MouseClic on stage   :

    // clicMax >> to stop some of these days the mouseMove listener
    var clicMax = 3;
    var clicNumber = 0;
    // penDownLoc retrieve the last MouseDown
    var ptInit =;
    var clicksArray = [ptInit.x,ptInit.y ];, onMouseMove);

    function onMouseMove(event)

    function clickEvent()
      var pt1 =;
    //trace("x,y location of last mouseDown event was " + pt1.x + ", " + pt1.y + " clicksArray.length >>> " + clicksArray.length );

    if (pt1.x != clicksArray[0] && pt1.y != clicksArray[1] )
    clicksArray = [];
    trace('NEW CLICK ' + clicNumber )
    // do something
    if($selection.length !=0)
    for(i=0;i<$selection.length; i++)
    trace("selection " + $selection[i].name)
    // try to stop listener
    if(clicNumber >= clicMax)
    //; // flashCrashes :-(
    //fl.removeEventListener('mouseMove'); // keep register mouseMove, 'onMouseMove')// keep register mouseMove }

     The clickEvent on stage is registered, but I can't kill the MouseEvent.MOVE
    I suppose that the " MouseEvent.MOVE " have to be removed, (peharps taking lot of memory )
    , sorry if my script is not very well optimized (I'm just a designer). But peharps can help.

  • ArandaAranda April 2013

    Just popped in to put in a +1 request for some sort mouse click listener. Utlimately I want to detect when the element selection changes, so I can grab custom element data and display it in the xJSFL panel. Can't believe Adobe didn't think of this one!

  • DaveDave April 2013

    Your prayers have already been answered - it turns out a "selectionChanged" event has been in ever since CS6 - they just didn't document it!

    An update for the xJSFL Event class is in the local repo, but not pushed yet. In the meantime, use this:

    var eventID = fl.addEventListener("selectionChanged", function ()
    { format("{i} elements selected", $selection.length);


  • ArandaAranda April 2013

    Awesome news!. Unfortunately I'm still on CS5.5, but this is one more good reason to upgrade.

  • ArandaAranda April 2013

    PS, be nice if these forums had a "subscribe to thread" option ;)

  • DaveDave April 2013

    Did you check your dashboard?

    There should be a button there that allows you to subscribe to entire categories. Weirdly, as the admin I can only subscribe all users, I can't see the button for myself, so not sure it works :(

  • ArandaAranda April 2013

    Ok thanks I'm subscribed to everything now. Obviously per-thread is much better, but this may be sufficient, depending on the level of activity around here :)

  • DaveDave April 2013
    Let's see if you get this then...

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with OpenID Sign In with Google Sign In with Twitter

Sign In Apply for Membership