从一个代码库编译适用于PC,Android和Mac的Flex Air应用程序?

时间:2012-05-18 06:48:47

标签: actionscript-3 flex compiler-construction cross-platform flex4.6

我想使用Air为PC,Mac,Android,Ios构建。

是否可以通过单个代码库执行此操作,如Adobe建议。

或者我需要维护4个独立的构建吗?

一些指导意见将不胜感激。

此致 ç

1 个答案:

答案 0 :(得分:0)

到目前为止,我已经能够维护一个代码库。我做过以下事情:

        private function getHostName() : void
        {
            if (NativeProcess.isSupported)
            {
                var OS : String = Capabilities.os.toLocaleLowerCase();
                var file : File;

                if (OS.indexOf('win') > -1)
                {
                    // Executable in windows
                    file = new File('C:\\Windows\\System32\\hostname.exe');
                }
                else if (OS.indexOf('mac') > -1 )
                {
                    // Executable in mac
                }
                else if (OS.indexOf('linux'))
                {
                    // Executable in linux
                }

                var nativeProcessStartupInfo : NativeProcessStartupInfo = new NativeProcessStartupInfo();
                nativeProcessStartupInfo.executable = file;

                var process : NativeProcess = new NativeProcess();
                process.addEventListener(NativeProcessExitEvent.EXIT, onExitError);
                process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutput);
                process.start(nativeProcessStartupInfo);
                process.closeInput();
            }
        }

        private function onOutput(event : ProgressEvent) : void
        {
            var strHelper : StringHelper = new StringHelper();
            formStationID.text = event.target.standardOutput.readUTFBytes(event.target.standardOutput.bytesAvailable);
            formStationID.text = strHelper.trimBack(formStationID.text, "\n");
            formStationID.text = strHelper.trimBack(formStationID.text, "\r");
        }

        private function onExitError(event : NativeProcessExitEvent) : void
        {
        }

照顾本机电话。除了本机调用之外,我发现很少有一些事情无法编写,但在这些内容中,上述方法也适用于代码集的任何部分。

相关问题