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
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.
Cheers,
Dave
Kewl.
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
Oh, by the way are you using c or c++?
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!?
Hmmm... I don't know if it is in the good topic (I don't speak C/C++)
playing with fl.tools I've tried this to retrieve MouseClic on stage :
xjsfl.init(this);
clear();
// clicMax >> to stop some of these days the mouseMove listener
var clicMax = 3;
var clicNumber = 0;
// penDownLoc retrieve the last MouseDown
var ptInit = fl.tools.penDownLoc;
var clicksArray = [ptInit.x,ptInit.y ];
xjsfl.events.add(MouseEvent.MOVE, onMouseMove);
function onMouseMove(event)
{
clickEvent()
}
function clickEvent()
{
var pt1 = fl.tools.penDownLoc;
//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 = [];
clicksArray.push(pt1.x,pt1.y);
clicNumber+=1;
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)
{
//xjsfl.events.removeAll(MouseEvent.MOVE); // flashCrashes :-(
//fl.removeEventListener('mouseMove'); // keep register mouseMove
xjsfl.events.remove(MouseEvent.MOVE, '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.
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);
});
:D