Copy link to clipboard
Copied
I have rewritten these two methods in the jsx file without any effect
function mouseDown() {
fl.trace("Mouse button has been pressed");
}
function mouseDown(pt) {
fl.trace("x = "+ pt.x+" :: y = "+pt.y);
}
This method may also report errors
fl.addEventListener("mouseDown", myFunction);
Thank you very much if you can!
Hi.
These methods are for extensible tools: activate(), configureTool(), deactivate(), keyDown(), keyUp(), mouseDoubleClick(), mouseDown(), mouseMove(), mouseUp(), notifySettingsChanged(), and setCursor().
The PolyStar tool uses the structure/code of an extensible tool. You can find it in:
<ADOBE_ANIMATE_INSTALL_FOLDER>/<LANGUAGE>/First Run/Tools
Regards,
JC
If you want to implement shape creation with JSFL, I recommend examining the script PolyStar.jsfl located in the Tools subfolder. It demonstrates the correct usage of mouseDown(), mouseUp(), and mouseMove().
I advise against subscribing to the mouseMove event. While technically possible, I believe it is not a good practice. I have seen panels that degrade the overall program performance because they subscribed to computationally intensive functions on mouseMove.
If you want to incorporate drawing
...Copy link to clipboard
Copied
no such event for fl. check the api.
Copy link to clipboard
Copied
Thank you for your answer,this method is used in the API, but I don't know how to use it
function mouseDown() {
fl.trace("Mouse button has been pressed");
}
function mouseDown(pt) {
fl.trace("x = "+ pt.x+" :: y = "+pt.y);
}
link:https://github.com/AdobeDocs/developers-animatesdk-docs/blob/master/JSAPI.md
Copy link to clipboard
Copied
fl has that method, but not that event. further there is no jsfl object that has that method and event. ie, use an on-stage object.
Copy link to clipboard
Copied
Thank you, got it. another problem, this event is ok, with log output
function onMove() {
fl.removeEventListener("mouseMove", myFunction)
}
function myFunction() {
fl.trace("move");
}
But this is not output log
function myFunction(pt) {
fl.trace("x = " + pt.x + " :: y = " + pt.y);
}
I see that the API has this method, may I ask how to write it, Thank you again
Copy link to clipboard
Copied
myFunctions argument is the event, not a point, assuming you're using a mousemove event listener
Copy link to clipboard
Copied
Sorry, I made a mistake in copying, It should be this code
fl.addEventListener("mouseMove", myFunction);
I changed it to event
function myFunction(event) {
fl.trace(event);
}
but log print undefined
Copy link to clipboard
Copied
this code worked for me
Copy link to clipboard
Copied
Hi.
These methods are for extensible tools: activate(), configureTool(), deactivate(), keyDown(), keyUp(), mouseDoubleClick(), mouseDown(), mouseMove(), mouseUp(), notifySettingsChanged(), and setCursor().
The PolyStar tool uses the structure/code of an extensible tool. You can find it in:
<ADOBE_ANIMATE_INSTALL_FOLDER>/<LANGUAGE>/First Run/Tools
Regards,
JC
Copy link to clipboard
Copied
got it, this means that I cannot add these events in my customized panel, but need to use the add extension tool to achieve
Copy link to clipboard
Copied
Using an extensible tool is probably the best way to track the cursor position. Listening to the "mouseMove" event is also possible, although I think it's kinda tricky to use it.
But what exactly do you need to do?
Copy link to clipboard
Copied
I want to quickly draw a circle between two points, so I need two coordinates to calculate, such as quickly drawing a green circle that can be tangent to two points
Copy link to clipboard
Copied
If you want to implement shape creation with JSFL, I recommend examining the script PolyStar.jsfl located in the Tools subfolder. It demonstrates the correct usage of mouseDown(), mouseUp(), and mouseMove().
I advise against subscribing to the mouseMove event. While technically possible, I believe it is not a good practice. I have seen panels that degrade the overall program performance because they subscribed to computationally intensive functions on mouseMove.
If you want to incorporate drawing as a functionality in your panel, write it as a tool script, and then integrate it appropriately in the panel using:
MMExecute( "fl.selectTool( 'yourCustomToolName' );" );
Copy link to clipboard
Copied
Thank you very much, I will follow this idea