zoukankan      html  css  js  c++  java
  • 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>

  • 相关阅读:
    NUnit进行单元测试
    VSTS 安装步骤
    使用 Visual Studio Team Test 进行单元测试
    vss使用技巧
    struts 2.1 action 学习
    apache2 反向代理
    zz mysql中文
    trac ubuntu 安装
    ejb 3中bean的种类
    linux下VsFTP配置全方案
  • 原文地址:https://www.cnblogs.com/yg_zhang/p/1672393.html
Copyright © 2011-2022 走看看