- Home /
Events In Javascript - Prime31
Hello,
I'm using a Prime31 plugin that allows me to get a native text field pop up in the application. The documentation is in C#, and I'm not 100% sure how to translate into JavaScript, in terms of getting an event back.
So, to activate the pop up, you do this:
// Shows a prompt with one text field
public static void showPromptWithOneField( string title, string message, string placeHolder, bool autocomplete )
In which, I do this:
EtceteraBinding.showPromptWithOneField( "Title", "Message", "Holder", true );
Which works fine, but now I want to listen out for when the user presses 'Okay' on the text field. There is an event that listens out for this:
// Fired when the user finishes entering text in the prompt
public static event Action<string> singleFieldPromptTextEnteredEvent;
I assumed, I do this:
function singleFieldPromptTextEnteredEvent(Action : String){
}
But no luck, I have a print in there that prints the action string, but it never seems to get called. What am I doing wrong? Thanks
This forum discussion might help you, as they discuss how to write event handlers in UnityScript:
http://forum.unity3d.com/threads/167895-An-Event-Listener-for-Unity-JavaScript