I need to find t开发者_开发问答he IP Address of the system my AIR App is running. I found a similar question here. But the solution is with SDK version higher than 3.5 it seems. Can this be done using Flex 3?
The link you've found isn't related to Flex SDK version but related to AIR SDK and runtime version. The code used in the link requires AIR ADK 2 (because of NetworkInterface
usage). You can use AIR 2 SDK with Flex SDK 3.5 very easily. Follow these instructions for example.
To get the IP Address in an AIR 1.0 App; it is possible. But, tedious.
First, you have to use a tool such as Merapi. Merapi will run as a "server" on the clients machine. You can access that server using the RemoteObject tag. So, you can write native Java code to get the IP address, expose that code as a service and access that service via the Merapi project.
You'll have to create your own installer to make this work; to install Merapi in the client machine as part of the app install.
I've done something similar using the WebORB .NET version, although we used it to access an MS Access database. It's a pain. I would not recommend this approach lightly.
I didn't try but Socket and its property localAddress can be used to get local IP for Adobe Air 1.0
Supported Air Version
API doc says AIR 1.0, and Header say Air 2.6 and earlier
Hopes that helps
精彩评论