executing javascript upon switching scene?

I would expect to have the code in the "end" action of my scene to be executed when I switch scenes. However, this does not seem to be the case. So, assuming that this is actually possible, I must be doing something wrong

My case is something like this:

- my scene starts and I start some setIntervals and some listeners. I entered this code in the actions panel of my scene in the "Start" section.
- I switch scenes and now I want to make sure my intervals are cleared and my listeners removed. I entered this code in the actions panel of my scene in the "End" section.

Is there anything obvious that I must do differently?

//Edit - to be clear: I want to be able to exit my scene before the animations have ended.

For now, the scene end action will only be called when a scene have actually fully finished. What I'd do in the meantime is to set up a "destroy" function that can be called from anything that switches the scene.

E.g. in the start action of the scene, you can create something like this

Thanks for the reply, the message is clear. Unfortunately, it is not a viable option out-of-the-box for me, because I need to work with a Sencha Animator template that is specifically designed by a third party and is used for mobile ads. This template manages scenes based on device orientation, so scenes can switch without me explicitly knowing it.

I'll take it up with them to see if they can add some events that let me know what's going on.

Nevertheless, it seems like an important feature to have in the gui. I would see 4 types of actions, maybe. An init action, that is called right before showing the new scene, the start and end actions as they are now and an important exit action, that is called whenever the scene is closed.
Can you indicate if this is added in the next version of Animator (as you said you're planning on making that easier)?

//Edit:
I may have found a good working solution for now. Every start action of every scene I start like so: