0

我想在 flex builder 中获取主板 ID。这是我的代码。我按照此代码构建我自己的从运行 AIR 应用程序的设备中检索制造商信息

但是我收到了这个错误TypeError: Error #1009: Cannot access a property or method of an null object reference。

请给我一些解决方案。

<?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>

这是错误.. http://i.stack.imgur.com/QoTfb.png

4

0 回答 0