4

Ii am trying to find the ip addres by using as3 in adobe Flash professional cs5. I don't how to do this. Is it possible to find the Ip address using as3?

Mattias
  • 3,907
  • 4
  • 28
  • 50
Mercy
  • 1,862
  • 9
  • 39
  • 75

2 Answers2

4

Setting Air 2.5 Target output in CS5 is the way of getting ip address.

import flash.net.InterfaceAddress;
import flash.net.NetworkInfo;
import flash.net.NetworkInterface;

function findIPAddress():void
{
    var networkInfo = NetworkInfo.networkInfo;
    var interfaces = networkInfo.findInterfaces();
    var interfaceObj;
    var address;

    //Get available interfaces
    for (var i = 0; i < interfaces.length; i++)
    {
        interfaceObj = interfaces[i];

        for (var j = 0; j < interfaceObj.addresses.length; j++)
        {
            address = interfaceObj.addresses[j];

            trace(address.address + "\n");
        }
    }
}

findIPAddress();
Rajneesh Gaikwad
  • 1,193
  • 2
  • 14
  • 30
4

No, it is not possible from AS3 without using any server side technology. You can use a loader and load something like http://whatismyip.org/ to get the IP. But without any server (i.e. from pure flash) it is not possible.

taskinoor
  • 45,586
  • 12
  • 116
  • 142
  • Can I use HTML with as3 to get IP Address? – Mercy Jan 02 '12 at 12:29
  • I am not very sure about HTML. May be it is possible with JavaScript. This might help: http://stackoverflow.com/questions/391979/get-client-ip-using-just-javascript – taskinoor Jan 02 '12 at 14:54