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
Apache flex 动态生成HTML页面_Apache Flex_Actionscript 3 - Fatal编程技术网

Apache flex 动态生成HTML页面

Apache flex 动态生成HTML页面,apache-flex,actionscript-3,Apache Flex,Actionscript 3,我正在编写一个简单的html页面创建者,它将根据自定义设置生成html代码。现在我想添加一个“Demo”按钮,它将动态生成一个html页面,供用户查看最终结果 有没有办法在在线应用程序中生成它 谢谢您可以这样做: var url:String = "http://servlet.url"; var request:URLRequest = new URLRequest(url); request.method = URLRequestMethod.POST; var variables:URLV

我正在编写一个简单的html页面创建者,它将根据自定义设置生成html代码。现在我想添加一个“Demo”按钮,它将动态生成一个html页面,供用户查看最终结果

有没有办法在在线应用程序中生成它


谢谢

您可以这样做:

var url:String = "http://servlet.url";
var request:URLRequest = new URLRequest(url);
request.method = URLRequestMethod.POST;
var variables:URLVariables = new URLVariables();
variables.html = source.of.your.html;
request.data = variables;
navigateToURL(request, "_blank");

因此,您基本上导航到服务器上的某个servlet,将您在Flex应用程序中创建的html作为POST参数发送给它,并在新窗口/选项卡中打开received responce。Servlet应该将收到的html发回给最终用户,允许预览创建的html。

实际上,您不需要使用服务器。您可以在Flash中使用javascript:URL实现您想要的内容,如下所示:

var request:URLRequest = new URLRequest("javascript:var w=window.open('', 'FlashGeneratedHTML', 'width=400, height=400'); w.document.write('<html><head></head><body>hello</body></html>');" );
navigateToURL(request, "_self");
var-request:URLRequest=new-URLRequest(“javascript:var w=window.open(“”,'FlashGeneratedHTML','width=400,height=400');w.document.write('hello');”);
导航URL(请求“_self”);

您只需将document.write()中的HTML代码替换为您自己的代码。

我不确定是否会尝试在Flex中构建类似的代码。理论上这是可能的。但是,使用HTML工具如CFEditor;为什么要重新创建控制盘?Ckeditor不是一个纯flex组件,我需要一个纯flex组件或simplye生成或运行html文件的方法,该文件将包含一些自定义代码。感谢您的回复,我实际上是在寻找一个不需要服务器端操作的动态情况。我知道可以用AIR完成,但我一直在寻找一些基于浏览器的解决方案。无论如何,现在很清楚,除了在这里使用服务器之外,没有其他解决方案。再次感谢,这就是我真正想要的:)非常感谢