• flex 内嵌js文件


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

    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"

    preinitialize="{initJSInterface()}"

    creationComplete="{creationCompleteHandler(event)}">

     <mx:Script>

     <![CDATA[

       import flash.utils.setInterval;

       import aw.external.JSInterface;

       // Embed jQuery library into Flex application

       [Embed(source="jquery-1.2.6.js",mimeType="application/octet-stream")]

       static private const J_QUERY_SCRIPT:Class;

       protected function initJSInterface():void{

        JSInterface.initialize();

        // Get embeded code as text

        var data:ByteArray = new J_QUERY_SCRIPT();

        data.position = 0;

        // Insert jQuery into HTML as virtual - without creating <SCRIPT> container

        JSInterface.pushJavaScript(data.readUTFBytes(data.length), '', true);

       }

       private var $:Function;

       protected function creationCompleteHandler(event:Event):void{

        // Now you can use jQuery through JSInterface or ExternalInterface

        $ = JSInterface.window.$;

        trace($('body'));

        trace($('embed')[0].src);

       }

     ]]>

     </mx:Script>

    </mx:Application>

  • 相关阅读:
    bootstrap媒体查询
    Qt用Zip压缩文件夹的一些坑
    QCanvasItem介绍-QT3
    C盘无损扩容
    ArcGis连接oracle失败:ORA-6413:连接未打开
    通过ArcMap发布服务
    windows系统下使用cd命令
    C语言运算符优先级
    c/c++ 指针
    c++数组易错点总结
  • 原文地址:https://www.cnblogs.com/yg_zhang/p/1672393.html
Copyright © 2020-2023  润新知