as3.0 获取本地IP
作者:互联网
package { import flash.display.Sprite; import flash.net.InterfaceAddress; import flash.net.NetworkInfo; import flash.net.NetworkInterface; public class GetAddress extends Sprite { public function GetAddress() { var networkInfo: NetworkInfo = NetworkInfo.networkInfo; var interfaces:Vector.<NetworkInterface> = networkInfo.findInterfaces(); if (interfaces != null) { trace("Interface count: " + interfaces.length); for each(var interfaceObj: NetworkInterface in interfaces) { trace("\nname: " + interfaceObj.name); trace("display name: " + interfaceObj.displayName); trace("mtu: " + interfaceObj.mtu); trace("active?: " + interfaceObj.active); trace("parent interface: " + interfaceObj.parent); trace("hardware address: " + interfaceObj.hardwareAddress); if (interfaceObj.subInterfaces != null) { trace("# subinterfaces: " + interfaceObj.subInterfaces.length); } trace("# addresses: " + interfaceObj.addresses.length); for each(var address: InterfaceAddress in interfaceObj.addresses) { trace(" cuplayer.com type: " + address.ipVersion); trace(" cuplayer.com address: " + address.address); trace(" cuplayer.com broadcast: " + address.broadcast); trace(" cuplayer.com prefix length: " + address.prefixLength); } } } } } }
标签:as3.0,interfaceObj,trace,IP,flash,本地,address,var,import 来源: https://www.cnblogs.com/zqiang0803/p/14536361.html