繁体   English   中英

从AIR Flex打开iTunes

[英]Open iTunes from AIR Flex

我正在尝试从Flex的AIR桌面应用程序启动iTunes应用程序。 但是我无法像try catch循环的catch错误中那样执行代码中的相同操作。

以下是我用于从AIR打开iTunes的代码段:

try
                    {
                        if(currentOS.indexOf("Windows") >= 0)
                        {
                            prepareFilesForSynciOS('Windows');
                            fileItunes = File.applicationDirectory.resolvePath("C:\\Program Files (x86)\\iTunes\\iTunes.exe");
                            //fileItunes1 = File.applicationDirectory.resolvePath("C:\Program Files (x86)\iTunes\iTunes.exe");

                            //Alert.show(" fileItunes " + fileItunes.nativePath);
                            //Alert.show(" fileItunes1 " + fileItunes1.nativePath);

                            if(!fileItunes.exists)
                            {
                                fileItunes = File.applicationDirectory.resolvePath("C:\\Program Files\\iTunes\\iTunes.exe");
                                //fileItunes1 = File.applicationDirectory.resolvePath("C:\Program Files (x86)\iTunes\iTunes.exe");

                                //Alert.show(" fileItunes 64 " + fileItunes.nativePath);
                                //Alert.show(" fileItunes1 64 " + fileItunes1.nativePath);
                            }


                            fileItunes.openWithDefaultApplication();
                        }
                        else if(currentOS.indexOf("Mac") >= 0 )
                        {
                            prepareFilesForSynciOS('Mac');
                            fileItunes = File.applicationDirectory.resolvePath("/Applications/iTunes.app");
                            fileItunes.openWithDefaultApplication();
                        }
                    }
                    catch(e:Error)
                    {
                        //Alert.show("iTunes was not found on this Computer.");
                        navigateToURL( new URLRequest("http://www.apple.com/itunes/download/"));
                    }

当我对错误消息发出警报时,出现TypeError 1009。

任何帮助表示赞赏。 :)

谢谢,安吉。

违反“空中安全”沙箱之外的任何内容都是违法的。 您不能运行ITunes应用程序,除非它与ITunes处于沙盒位置。

由于Air无法做到这一点,因此您可能必须依赖于本机扩展,即c ++或任何其他本机应用程序编程(我想它们在某个地方之外已经可用)来调用itunes应用程序。 使用Air套接字在本机应用程序上调用它们。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM