This is the way to get the IP and pcname in JS, now put it in the Flex startup template. Look at the code:
Copy Code code as follows:
function Getclientpcname ()
{
"Initialize and script ActiveX controls that are not marked for security in your browser's Internet Options," set to Enabled! \ n \ nplease then refresh the landing page! "
var wshshellpcname = new ActiveXObject ("Wscript.Network");
var ComputerName = Wshshellpcname.computername;
return ComputerName;
}
function Getclientip ()
{
var wshshellip = new ActiveXObject ("Rcbdyctl. Setting ");
var ip = wshshellip.getipaddress;
return IP;
}
This code is placed in the HTML template,
Remember that the template is not bin-debug, why everyone is more clear ah
Flex Foreground Code
Copy Code code as follows:
<?xml version= "1.0" encoding= "Utf-8"?>
<s:application xmlns:fx= "http://ns.adobe.com/mxml/2009"
Xmlns:s= "Library://ns.adobe.com/flex/spark"
xmlns:mx= "Library://ns.adobe.com/flex/mx" xmlns:supportclasses= "com.esri.ags.skins.supportclasses.*" minWidth= " 955 "minheight=" creationcomplete= "init ()" >
<fx:Script>
<! [cdata[
Import Mx.controls.Alert;
Public function init (): void
{
var strpcname:string = Externalinterface.call ("Getclientpcname");
var strpcid = Externalinterface.call ("Getclientip");
Mx.controls.Alert.show (strpcname+ "" +strpcid);
}
]]>
</fx:Script>
<s:layout>
<supportClasses:AttachmentLayout/>
</s:layout>
<fx:Declarations>
<!--place non-visual elements (such as services, value objects) here-->
</fx:Declarations>
<mx:datagrid x= "186" y= "173" >
<mx:columns>
<mx:datagridcolumn headertext= "Column 1" datafield= "col1"/>
<mx:datagridcolumn headertext= "column 2" datafield= "col2"/>
<mx:datagridcolumn headertext= "Column 3" datafield= "Col3"/>
</mx:columns>
</mx:DataGrid>
</s:Application>
Externalinterface realizes the communication between JS and as
This method can only be implemented under IE, and must also set IE security level
The results of the operation are as follows: