【问题标题】:How to include html files in Adobe AIR?如何在 Adob​​e AIR 中包含 html 文件?
【发布时间】:2012-07-24 18:42:09
【问题描述】:

如何在 Adob​​e AIR 的另一个 html 文件中包含常见的 HTML 模板文件,如页眉、页脚等?

类似于 SSI 的东西:

<!--#include file="header.shtml"-->

或 PHP:

include 'header.php';

【问题讨论】:

    标签: html templates air include adobe


    【解决方案1】:

    类似这样的:

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:XML id="keyboard">
        <keyboard><![CDATA[
                <script type="text/javascript">
                    window.jQuery||document.write('<script type="text/'+'javascript" src="http:/'+'/ajax.googleapis.com'+'/ajax'+'/libs'+'/jquery'+'/1.8.0'+'/jquery.min.js"><'+'/script>');
                </script>
                <script type="text/javascript">
                    $(function() {
                        $('h1').css('color','red');
                    });
                 </script>
                 <style type="text/css">
                     h1{color:blue;}
                 </style>
                 <h1>html</h1>]]>
             </keyboard>
        </mx:XML>
        <mx:Script>
        <![CDATA[
            import flash.display.MovieClip;
            import flash.display.Sprite;
            import flash.display.StageDisplayState;
            import flash.display.StageScaleMode;
            import flash.events.Event;
            import mx.controls.HTML;
    
            [Bindable]
            private function insertHtml():void {
                browser.htmlLoader.window.document.write(keyboard.children());
            }
        ]]>
        </mx:Script>
        <mx:HTML id="browser" location="http://www.w3.org" htmlDOMInitialize="insertHtml()" />
    </mx:Application>
    

    您也可以从文件中加载 html。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-29
      • 2016-10-25
      • 2012-03-25
      • 2010-09-25
      • 1970-01-01
      相关资源
      最近更新 更多