我想在flex builder中获取主板ID。这是我的代码。我按照此代码构建自己的Retrieve manufacturer information from device that AIR app is running on
但我收到此错误 TypeError:错误#1009:无法访问空对象引用的属性或方法。
请给我一些解决方案。<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="100%" height="100%" showStatusBar="false" verticalAlign="middle"
name="Login" windowComplete="init()">
<mx:Script>
<![CDATA[
import flash.desktop.NativeProcess;
import flash.desktop.NativeProcessStartupInfo;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.filesystem.File;
private var process:NativeProcess;
private function init():void
{
var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
var file:File = new File("C:/Windows/System32/cmd.exe");
nativeProcessStartupInfo.executable = file;
var processArgs:Vector.<String> = new Vector.<String>();
processArgs.push("wmic baseboard get serialnumber");
nativeProcessStartupInfo.arguments = processArgs;
process.start(nativeProcessStartupInfo);
process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
process.exit();
}
private function onOutputData(event:ProgressEvent):void
{
var data:String = process.standardOutput.readUTFBytes(process.standardOutput.bytesAvailable);
txtreq.text = data;
}
]]>
</mx:Script>
<mx:Panel id="panel1" width="368" height="84" borderAlpha="0.47" dropShadowVisible="true"
horizontalCenter="-10" layout="absolute" title="Activation" verticalCenter="-10">
<mx:TextInput id="txtreq" x="10" y="10" width="293" editable="true"/>
</mx:Panel>
</mx:WindowedApplication>