Skip to main content
Participant
March 8, 2021
Answered

Reacting to Animate events inside an extension

  • March 8, 2021
  • 4 replies
  • 355 views

Hi everyone,

 

I'm trying to find a way to react to events happening into Animate. My focus right now is being able, using an extension, to detecte when I enter in a symbol:

  • Using ctrl + E,
  • or by double-clicking it.

 

I'm using the JavaScript API. I have a minimal example script running, but I cant find anything related to Animate events listeners. Are events happening in Animate avaliable in some way to extensions developers, and is there a way to subscrive to them?

 

Please keep in mind that I am new to developing this kind of extension, so I might be missing something obvious.

 

Many thanks.

    This topic has been closed for replies.
    Correct answer JoãoCésar17023019

    Hi.

     

    When you enter a symbol, the current timeline changes. So you can listen for the timelineChanged event. Like this:

    var myFunction = function ()
    {
        fl.trace("timeline changed");
    }
    
    var eventID = fl.addEventListener("timelineChanged", myFunction);

     

    https://www.adobe.io/apis/creativecloud/animate/docs.html#!AdobeDocs/developers-animatesdk-docs/master/flash_object_(fl)/fl1.md

     

    I hope this helps.

     

    Regards,

    JC

    4 replies

    FrancoisGAuthor
    Participant
    March 9, 2021

    Hi JoãoCésar, this is very helpfull, I'm having a look at it. Thank you.

    JoãoCésar17023019
    Community Expert
    Community Expert
    March 9, 2021

    Also, this documentation is older...

     

    https://help.adobe.com/archive/pt_BR/flash/cs5/flash_cs5_extending.pdf

     

    ... but often times I find it more efficient to search for the APIs.

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    March 9, 2021

    Hi.

     

    When you enter a symbol, the current timeline changes. So you can listen for the timelineChanged event. Like this:

    var myFunction = function ()
    {
        fl.trace("timeline changed");
    }
    
    var eventID = fl.addEventListener("timelineChanged", myFunction);

     

    https://www.adobe.io/apis/creativecloud/animate/docs.html#!AdobeDocs/developers-animatesdk-docs/master/flash_object_(fl)/fl1.md

     

    I hope this helps.

     

    Regards,

    JC

    kglad
    Community Expert
    Community Expert
    March 8, 2021

    there are some event listeners but i'm not aware of one that would detect when you enter edit mode.

    FrancoisGAuthor
    Participant
    March 9, 2021

    Hi,

     

    Ok. I will look at the event system in further details.

     

    Could you point me to those something linked to the event listeners, like a specific part of the documentation or a code snippet? The JSAPI doc is not really user friendly for newcomers.