![](/img/trans.png)
[英]create custom chrome adobe air desktop application using flex4 sparks controls
[英]Open Webpage in Adobe Flex Desktop Application
我们正在使用Adobe Flex开发一个小型桌面应用程序。 在此应用程序中,我们将有一个带有输入框的屏幕,用户可以在其中输入任何网站的URL,然后输入。
提供URL之后,桌面应用程序将在URL输入框正下方的同一屏幕中打开该网页。 我们还希望提供一个选项来手动捕获打开的网页的屏幕截图(即单击按钮)。
当在桌面应用程序中打开网页时,我们的屏幕应该像浏览器一样工作,也就是说,我们可以通过单击网页转到任何内部页面,而不必在输入框中提供另一个URL。
我们已经搜索了很多与此有关的东西,但没有任何结果。 谁能解释一下,我们如何在桌面应用程序中实现这种功能? 或可以使用Adobe Flex制作此应用程序吗?
您的解决方案将不胜感激。 提前致谢。
您可以使用HTML控件来实现 。
举个例子:
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="920" height="580">
<fx:Script>
<![CDATA[
protected function btn_history_back_clickHandler(event:MouseEvent):void
{
// history back
html_browser.historyBack();
}
protected function btn_history_forward_clickHandler(event:MouseEvent):void
{
// history forward
html_browser.historyForward()
}
protected function btn_go_clickHandler(event:MouseEvent):void
{
var url:String = txt_url.text;
if(url != '')
{
if(url.substr(0, 4) == 'http')
{
// open the typed url
html_browser.location = url;
}
}
}
protected function html_browser_locationChangeHandler(event:Event):void
{
// update our url text input
txt_url.text = html_browser.location;
}
]]>
</fx:Script>
<mx:HTML id="html_browser" x="6" y="39" width="905" height="511"
locationChange="html_browser_locationChangeHandler(event)"/>
<s:Button id="btn_forward" x="38" y="10" width="28" label=">" click="btn_history_forward_clickHandler(event)"/>
<s:Button id="btn_go" x="858" y="10" width="50" label="GO" click="btn_go_clickHandler(event)"
enabled="true"/>
<s:TextInput id="txt_url" x="74" y="10" width="775"/>
<s:Button id="btn_back" x="10" y="10" width="28" label="<" click="btn_history_back_clickHandler(event)"/>
</s:WindowedApplication>
这会给你这样的东西(我按下后退按钮以显示不同的页面时,它是同一窗口):
当然,这只是一个非常简单的示例,向您展示如何开始,可以对其进行改进并使之适应您的特定需求。
希望能对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.