This might be a silly question. But how can I call a function (to execute) from a class to the timeline.
For example, I have the class "Test" and I want to execute the function "Next" on the timline (which it is only a function to show next slide).
Hope you understand what I'm trying to do.
Thank you!
The best practice for communication (in this scenario!) is to use
Event
s.Test
and registers an event listener.Test
dispatch anEvent
.Event
will be executed.Please take a look at this question that wants to send additional information to the main timeline. In your case, you do not need a custom
Event
, because you do not want to send any information along. You only want to communicate the occurrence of the event. You can put that information into the type of the event. an example for a dispatch could look like this:Creating a custom class allows you to put that
String
literal that describes the type into a constant, which prevents errors caused by accidentally misspelling the type. That might be a reason to create a customEvent
class anyway, even only for the sake of a place to put those constants.Again, this would do the same as the previous line. this is also covered in the other question and the answer to it. Please take a look.