<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    ivaneeo's blog

    自由的力量,自由的生活。

      BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
      669 Posts :: 0 Stories :: 64 Comments :: 0 Trackbacks
    功能描述:在Flex中嵌套框架,并且進(jìn)行數(shù)值傳遞
    1、編輯Flex框架組件iFrame.mxml
    <?xml version="1.0" encoding="utf-8"?>
        <mx:Script>
        <![CDATA[
            import flash.external.ExternalInterface;
            import flash.geom.Point;
            import flash.net.navigateToURL;
            private var __source: String;
            /**
             * Move iframe through ExternalInterface. The location is determined using localToGlobal()
             * on a Point in the Canvas.
             **/
            private function moveIFrame(): void
            {
                var localPt:Point = new Point(0, 0);
                var globalPt:Point = this.localToGlobal(localPt);
                ExternalInterface.call("moveIFrame", globalPt.x, globalPt.y, this.width, this.height);
            }
            /**
             * The source URL for the IFrame. When set, the URL is loaded through ExternalInterface.
             **/
            public function set source(source: String): void
            {
                if (source)
                {
                    if (! ExternalInterface.available)
                    {
                        throw new Error("ExternalInterface is not available in this container. Internet Explorer ActiveX, Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime are required.");
                    }
                    __source = source;
                    ExternalInterface.call("loadIFrame", source);
                    moveIFrame();
                }
            }
            public function get source(): String
            {
                return __source;
            }
            /**
             * Whether the IFrame is visible.
             **/
            override public function set visible(visible: Boolean): void
            {
                super.visible=visible;
                if (visible)
                {
                    ExternalInterface.call("showIFrame");
                }
                else
                {
                    ExternalInterface.call("hideIFrame");
                }
            }
        ]]>
        </mx:Script>
    </mx:Canvas>
    2、放置到要使用框架的Flex中index.mxml,并寫入引用哪個(gè)frame.html
    <ui:IFrame id="iFrame" source="frame.html" visible="true" width="100%" height="300"/>
    3、在引用框架的Flex生成頁index.html里加入:
         <1. wmode set to opaque
         在調(diào)用swf的后面加上"wmode","opaque"
         例如:"pluginspage", "
               "wmode","opaque"
         <2. the moveIFrame,hideIFrame,showIFrame,loadIFrame methods
         <script language="JavaScript" type="text/javascript">

    <!--
    // -----------------------------------------------------------------------------
    // Globals
    // Major version of Flash required
    var requiredMajorVersion = 9;
    // Minor version of Flash required
    var requiredMinorVersion = 0;
    // Minor version of Flash required
    var requiredRevision = 28;
    // -----------------------------------------------------------------------------
    // -->
    function moveIFrame(x,y,w,h) {
        var frameRef=document.getElementById("myFrame");
        frameRef.style.left=x;
        frameRef.style.top=y;
        var iFrameRef=document.getElementById("myIFrame");
          iFrameRef.width=w;
          iFrameRef.height=h;
    }
    function hideIFrame(){
        document.getElementById("myFrame").style.visibility="hidden";
    }

    function showIFrame(){
        document.getElementById("myFrame").style.visibility="visible";
    }
    function loadIFrame(url){
          document.getElementById("myFrame").innerHTML = "<iframe id='myIFrame' src='" + url + "'frameborder='0'></iframe>";
    }
    //要調(diào)用的內(nèi)容,加載前三個(gè)就可以了,后面這個(gè)函數(shù)是用來調(diào)用返回值
    function getEditorText(){
          return document.getElementById("myIFrame").contentWindow.GetEditorText1();
    }
    </script>
         <3. the 'myFrame' div
             在</body>這前寫入:
             <div id="myFrame" style="position:absolute;background-color:transparent;border:0         px;visibility:hidden;"></div>
    4、在Flex頁面index.mxml輸入的函數(shù)值,調(diào)用index.html中的'getEditorText'函數(shù),并且寫入到text1.text中
         text1.text=ExternalInterface.call('getEditorText',param1,param2,param3,...)
         getEditorText:函數(shù)名稱
         param:參數(shù)值
    5、在生成頁中取得框架中的函數(shù)
         框架內(nèi)的frame.html,放置在head之間:
        function GetEditorText1(){
         return getHTML(params);
         index.html生成頁的調(diào)用,設(shè)置在head之間:
         function getEditorText(){
          return document.getElementById("myIFrame").contentWindow.GetEditorText1();
         }
        
    后記:實(shí)際中在這里只是調(diào)用一個(gè)層放在對(duì)應(yīng)位置而已,當(dāng)我們在Flex中做申縮動(dòng)作時(shí),層也要跟著改變,我是如此處理的:
         設(shè)置move或show事件,當(dāng)move或show時(shí)則調(diào)用:iFrame.source = "frame.html"
    參考:

    具體的一個(gè)例子——使用IFrame這個(gè)框架的一個(gè)頁面的代碼如下:

    <!-- saved from url=(0014)about:internet -->
    <html lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script src="AC_OETags.js" language="javascript"></script>
    <style>
    body { margin: 0px; overflow:hidden }
    </style>


    <script>
    <!--
    function moveIFrame(x,y,w,h) {
    // alert("move to " + x + "," + y + ", " + w + "/" + h);
        var frameRef=document.getElementById("myFrame");
        frameRef.style.left=x;
       frameRef.style.top=y;
        frameRef.width=w;
        frameRef.height=h;
    }

    function hideIFrame(){
    // alert("hide");
        document.getElementById("myFrame").style.visibility="hidden";
    }

    function showIFrame(){
    // alert("show");
        document.getElementById("myFrame").style.visibility="visible";
    }

    function navigateTo(url) {
    // alert("nav to " + url);
    // alert("from " + document.getElementById("myFrame").location);
    document.getElementById("myFrame").src = url;
    }

    -->
    </script>


    <script language="VBScript">
    <!--

    // Catch FS Commands in IE, and pass them to the corresponding JavaScript function.
    Sub flexapp_FSCommand(ByVal command, ByVal str)
        call flexapp_DoFSCommand(command, str)
    end sub

    // -->
    </script>
    </head>
    <body style="margin:0px">

    <object onMouseDown="document.body.focus();"
       classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
      

    codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,14

    ,0'
       width='100%' height='100%'
       id='flexapp' name='flexapp'>
       <param name='flashvars' value=''>
       <param name='src' value='EXPIframe.swf'>
       <param name="wmode" value="opaque">
       <embed pluginspage='http://www.macromedia.com/go/getflashplayer' width='100%'

    height='100%'
           flashvars=''
           src='EXPIframe.swf'
           name='flexapp'
           wmode="opaque"
           swLiveConnect="true"
       />
    </object>

    <iframe id="myFrame" name="myFrame"
        frameborder="0"
        style="position:absolute;background-

    color:transparent;border:0px;visibility:hidden;"></iframe>

    </body>
    </html>

    posted on 2012-03-08 22:48 ivaneeo 閱讀(2550) 評(píng)論(1)  編輯  收藏 所屬分類: flex-我酷所以我在

    Feedback

    # re: Flex組件IFrame中嵌入HTML頁面的方法 2014-08-14 16:54 12
    12123  回復(fù)  更多評(píng)論
      

    主站蜘蛛池模板: 亚洲乱码中文字幕久久孕妇黑人| 亚洲精品女同中文字幕| 黄在线观看www免费看| 亚洲熟妇AV一区二区三区浪潮| 国产色爽女小说免费看| 一级午夜a毛片免费视频| 亚洲成a人片77777老司机| 中国在线观看免费国语版| 羞羞视频免费网站含羞草| 亚洲av无码片在线播放| 毛片高清视频在线看免费观看| 日韩一级片免费观看| 中文字幕亚洲综合久久2| 日韩高清免费在线观看| 光棍天堂免费手机观看在线观看| 亚洲人成777在线播放| 亚洲精品网站在线观看不卡无广告| 好久久免费视频高清| 亚洲精品国产第一综合99久久 | 亚洲男人天堂2020| 男女免费观看在线爽爽爽视频 | 亚洲AV噜噜一区二区三区| 久久久影院亚洲精品| 国产免费131美女视频| 最近2019免费中文字幕6| 人妻无码中文字幕免费视频蜜桃| 亚洲最大视频网站| 在线观看亚洲av每日更新| 成人免费无码大片A毛片抽搐| 中文字幕无码日韩专区免费| 亚洲av无码成人精品区一本二本| 亚洲AV日韩AV永久无码下载| 亚洲AV网站在线观看| 在线观看免费人成视频| 国产免费AV片在线观看| 免费视频成人国产精品网站 | 亚洲欧美日韩综合俺去了| 亚洲黄色三级视频| 亚洲国产一成人久久精品| 亚洲精品成a人在线观看| 日韩黄色免费观看|