Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 访问flex AIR中通过htmlLoader加载的nativeWindow内容_Actionscript 3_Apache Flex_Air - Fatal编程技术网

Actionscript 3 访问flex AIR中通过htmlLoader加载的nativeWindow内容

Actionscript 3 访问flex AIR中通过htmlLoader加载的nativeWindow内容,actionscript-3,apache-flex,air,Actionscript 3,Apache Flex,Air,我正在向特定url发送请求,作为响应,该url将提供纯文本,我可以在nativeWindow中显示该文本,代码如下所示: public function HtmlContentWindow(urlString:String, urlMethod:String = URLRequestMethod.GET) { var urlReq:URLRequest = new URLRequest(urlString); urlReq.method=urlMe

我正在向特定url发送请求,作为响应,该url将提供纯文本,我可以在nativeWindow中显示该文本,代码如下所示:

    public function HtmlContentWindow(urlString:String, urlMethod:String = URLRequestMethod.GET)
    {
        var urlReq:URLRequest = new URLRequest(urlString);
        urlReq.method=urlMethod;

        var initOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
        initOptions.owner=NativeApplication.nativeApplication.activeWindow;
        super(initOptions);

        var htmlLoader:HTMLLoader = new HTMLLoader();
        htmlLoader.width=this.width;
        htmlLoader.height=this.height;

        var nativeMenu:NativeMenu = new NativeMenu();
        var item:NativeMenuItem = new NativeMenuItem("Save content");


        nativeMenu.addItem(item);


        this.stage.scaleMode = StageScaleMode.NO_SCALE;
        this.stage.align="TL";
        this.stage.addChild(htmlLoader);
        this.visible=true;

        htmlLoader.load(urlReq);

    //  item.data=  <- no idea how can I get reference to the actual text loaded into the native window
        item.addEventListener(Event.SELECT,saveContent);
        this.menu= nativeMenu;


    }
公共函数HTMLContentTwinDow(urlString:String,urlMethod:String=URLRequestMethod.GET) { var urlReq:URLRequest=新的URLRequest(urlString); urlReq.method=urlMethod; var initOptions:NativeWindowInitOptions=new NativeWindowInitOptions(); initOptions.owner=NativeApplication.NativeApplication.activeWindow; 超级(初始选项); var htmloader:htmloader=新的htmloader(); htmlLoader.width=this.width; htmlLoader.height=this.height; var nativeMenu:nativeMenu=新建nativeMenu(); 变量项:NativeMenuItem=新的NativeMenuItem(“保存内容”); nativeMenu.addItem(项目); this.stage.scaleMode=StageScaleMode.NO_SCALE; this.stage.align=“TL”; this.stage.addChild(htmlLoader); 可见=真实; htmlLoader.load(urlReq);
//item.data=那么不要使用HTMLLoader。如果您仅加载纯文本,则可以使用URLLoader加载它(这使您能够完全访问加载的数据)并将其显示在纯文本字段中。谢谢,这就解决了问题。