簡體   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