Can';t从AdobeAIR访问YouTube API(使用JavaScript)

Can';t从AdobeAIR访问YouTube API(使用JavaScript),javascript,air,youtube,youtube-api,Javascript,Air,Youtube,Youtube Api,我是AdobeAIR的新手,我正试图通过JavaScript获取特定用户使用YouTube API的YouTube视频列表 我已经尝试了几个例子,当我简单地点击它(在Aptana Studio中)并作为JavaScript Web应用程序运行时,它们似乎都非常有效 只要我尝试运行与AdobeAIR应用程序相同的东西,我就不会得到任何数据。为什么呢?我不知道我是否忽略了一些非常明显的事情 这是我最近看到的: 有人能给我指出正确的方向,或者告诉我为什么这在Adobe Air中不起作用吗?我认为原因

我是AdobeAIR的新手,我正试图通过JavaScript获取特定用户使用YouTube API的YouTube视频列表

我已经尝试了几个例子,当我简单地点击它(在Aptana Studio中)并作为JavaScript Web应用程序运行时,它们似乎都非常有效

只要我尝试运行与AdobeAIR应用程序相同的东西,我就不会得到任何数据。为什么呢?我不知道我是否忽略了一些非常明显的事情

这是我最近看到的:


有人能给我指出正确的方向,或者告诉我为什么这在Adobe Air中不起作用吗?

我认为原因是Air不允许加载外部JavaScript文件:


我想其中一个选择就是玩弄他们的交叉脚本和沙箱功能…

更新:好的,下面是我如何让它工作的,从2019年开始访问的任何人都可以看到(帽子的提示):


请注意,这是我的代码的一个清理版本,我还没有尝试运行它,因此它可能无法开箱即用,但本质上就是这样

<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
    backgroundColor="#000000" verticalAlign="middle" horizontalAlign="center"
    creationComplete="init()" borderStyle="solid">

<mx:Script>
<![CDATA[
    import mx.core.UIComponent;

    public var html : HTMLLoader = null;
    protected var url : String  = null;


    protected function init()
    {
        /* Your embedded html with all the youtube REST calls is in the "local"
           subdirectory of the application directory. Note the relation between
           the local url, the sandbox root and the remote url. */
        var localUrl : String = "app:/local/yt.html";
        var sandboxRoot : String = "http://youtube.com/";
        var remoteUrl : String = "http://youtube.com/local/yt.html";

        html = new HTMLLoader();
        html.addEventListener(Event.COMPLETE, htmlLoaded);

        /* Embed your youtube html in an iframe that is loaded dynamically. You
           could also just have this html code in a separate html file and load
           it through html.load() instead of html.loadString(). */
        var htmlString : String = "<html>"
            + "<body><center>"
            +"<iframe width='100%' height='100%' src='" +remoteUrl
                +"' sandboxRoot='"+sandboxRoot+"' documentRoot='app:/' "
                +" allowCrossDomainXHR='true'" /* May not be necessary */
                +" id='yt' name='yt'></iframe>"
            + "</center></body></html>";

        /* The next line is needed to allow the REST API in the embedded html 
           to call home when loading through loadString. */
        html.placeLoadStringContentInApplicationSandbox = true; 
        html.loadString(htmlString);
    }

    protected function htmlLoaded(e:Event):void
    {
        html.removeEventListener(Event.COMPLETE, htmlLoaded);
        frame.addChild(html);
        trace("html load complete.");
    }
]]>
</mx:Script>
<mx:UIComponent id="frame" width="100%" height="100%" visible="true"/>
</mx:HBox>