flex中嵌入浏览器访问特定网页

flex中嵌入浏览器

在线预览地址:

   http://rj.8634.com/xiaoshandong/flexframe/flexframe/FlexApplication4.html

源代码下载

   https://files.cnblogs.com/files/ffmpeg/FlexApplication4_FlexBrowser.zip

截图如下:

  

步骤如下:

 1.工程中要加入flexframe.swc库文件

   swc下载地址: https://files.cnblogs.com/files/ffmpeg/flex-iframe-1.5.1.zip

mxml源代码

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                xmlns:flexiframe="http://code.google.com/p/flex-iframe/"
                horizontalAlign="center"
                verticalAlign="middle"
                viewSourceURL="srcview/index.html">

    <!-- Example project presentation -->
    <mx:ApplicationControlBar dock="true">
        <mx:Text selectable="false">
            <mx:htmlText><![CDATA[<font color="#000000" size="12"><b>flex-iframe - Navigation tree example</b><br>This example shows an IFrame with a navigation tree.</font>]]></mx:htmlText>
        </mx:Text>
    </mx:ApplicationControlBar>


    <mx:HBox width="100%" height="100%">

        <mx:Panel title="Tree" width="200" height="100%" >
             <mx:Tree id="tree" width="100%" height="100%" dataProvider="{treeData}"
                     labelField="@label" showRoot="false"
                     change="iFrame.source = (Tree(event.target).selectedItem.attribute('path').toString());"  />
        </mx:Panel>

        <mx:Panel width="100%" height="100%" title="Content" paddingTop="1" paddingBottom="1" paddingLeft="1" paddingRight="1" >
            <flexiframe:IFrame id="iFrame" source="http://www.cnblogs.com/" width="200" height="100%"/>
            <mx:ControlBar>
                <mx:CheckBox id="cbVisible" label="IFrame Visible" selected="true" click="iFrame.visible=cbVisible.selected"/>
            </mx:ControlBar>
        </mx:Panel>

    </mx:HBox>

    <mx:XMLList id="treeData">
        <node label="微信电子请柬">
            <node label="电子请柬1" path="http://m.web.7192.com/m110321" />
            <node label="电子请柬2" path="http://m.web.7192.com/m110316" />
            <node label="电子请柬3" path="http://m.web.7192.com/m172216" />
        </node>
        <node label="搜索">
            <node label="百度" path="http://www.baidu.com" />
            <node label="Yahoo" path="http://www.yahoo.com" />
        </node>
        <node label="flex-iframe">
            <node label="Home page" path="http://code.google.com/p/flex-iframe/" />
            <node label="Google group" path="http://groups.google.com/group/flex-iframe" />
        </node>
    </mx:XMLList>

</mx:Application>

 

posted @ 2015-03-31 14:16  小山东  阅读(374)  评论(0编辑  收藏  举报