I know is not the best practice, but for this example i must continue with this scheme:
In my timeline i have this:
addEventListener(KeyboardEvent.KEY_DOWN,handler);
function handler(event:KeyboardEvent){
if(event.charCode == 13){
trace('enter pressed');
}
}
Just a very simple enter key listener. In a class sometimes an action is triggered and I need to simulate the enter key press from the class in the timeline:
case 'enter':
{
trace('it works!');
dispatchEvent(new KeyBoardEvent(KeyBoardEvent.ENTER));
return;
}
I know the case is triggered bucause i see the trace msg. But my handler function is not triggered. How can i solve this? In a few words, the only thing i need is to execute a function located in my timeline from an external class.