【发布时间】:2014-01-23 20:48:48
【问题描述】:
好的,我正在 AS2 中创建一个 Flash HUD,它在 Surface 上运行并连接到我们的服务器。
就目前而言,我不得不硬编码要连接到 Surface 的 IP 地址,并且我正在努力解决这个问题。
我有 4 个文本字段供用户输入 IP 地址数据的 4 个字段。我目前的问题是,如果我按字面设置 String 变量,它可以正常工作。但是如果我动态创建字符串,而不是在一行上输出,它会分别输出 4 个字符串中的每一个。
这是我的代码:
var newIP1 = getIP.IPtext.IP1.text; //grabbing the data from the UI
var newIP2 = getIP.IPtext.IP2.text;
var newIP3 = getIP.IPtext.IP3.text;
var newIP4 = getIP.IPtext.IP4.text;
var ipArray = new Array(newIP1,newIP2,newIP3,newIP4); //setting the array
trace (ipArray.join(".")); // output the string, replacing the commas with a period
//output:
//10
//.255
//.255
//.22
//If I do this it works fine
var IPstr = "10.255.255.2";
trace(IPstr);
// output: 10.255.255.22
感谢您对此提供的任何帮助,在此先感谢。
【问题讨论】:
标签: string tcp actionscript-2 ip-address