Copy link to clipboard
Copied
Thanks in advance to anyone who can help troubleshoot this...
I've testing a basic network functionality using a Server side App on a remote LAN computer and a Client side App on the local computer. The communicate using sock.connect (see code below). When I introduce a the IP Address from a stored variable which is input in a text field it spits back IOErrors #2031.
This is the portion of the code that handles storing the contents of the text field in the :String var and then conneting to the Server using that IP String:
saveIP.addEventListener(MouseEvent.CLICK,addIP);
function addIP(Event:MouseEvent){
var inputMyIP:String = enterIP.text; // enterIP is the name of the input text field
trace(inputMyIP);
sock.connect(inputMyIP, 25000); //this var version of IP does not work???
//sock.connect('192.168.0.116', 25000); // this hard coded IP works
}
The socket class requires the IP to be a string. I realize that the input field is collecting the user input as .text. It's being stored in a String so should be converted as necessary right?
Thanks for any help you can lend!
Resolved.
I figured this out as there's an odd quirt in how Animate treats/interprets text information entered into an InputText Field that's dropped on the Stage via the GUI vs. creating an InputText Field using code - new TextField();
Seems input text fields store user input as a String natively which is what sock.connect() is seeking. So I solved the issue by creating the user input text field with script vs. GUI.
Hope this is helpful.
Copy link to clipboard
Copied
Resolved.
I figured this out as there's an odd quirt in how Animate treats/interprets text information entered into an InputText Field that's dropped on the Stage via the GUI vs. creating an InputText Field using code - new TextField();
Seems input text fields store user input as a String natively which is what sock.connect() is seeking. So I solved the issue by creating the user input text field with script vs. GUI.
Hope this is helpful.