Hybrid View

  1. #1
    Ext User
    Join Date
    Oct 2008
    Posts
    38
    Vote Rating
    0
    ranjeet is on a distinguished road

      0  

    Question Ext.air support

    Ext.air support


    Hi,

    I want to use Clipboard.js to do some copy/paste work in my project. For this i also included air package. When i run it, it gives me an error msg:

    air is undefined
    [IMG]chrome://firebug/content/blank.gif[/IMG]Ext.air.SystemTray=function(){var app=ai...TrayIcon){icon=app.icon;isWindows=true;}

    air is undefined
    var clipboard = air.Clipboard.generalClipboard;

    My jsp looks like:

    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>

    <link rel="stylesheet" type="text/css" href="styles/cpe.css">

    <!-- Include Ext scripts: -->
    <script type="text/javascript" src="js/adobe/AIRAliases.js"></script>

    <script type="text/javascript" src="js/extjs/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="js/extjs/ext-all.js"></script>
    <script type="text/javascript" src="js/extjs/ext-all-debug.js"></script>

    <script type="text/javascript" src="js/ext-air/ext-air.js"></script>

    <script type="text/javascript" src="js/ext-air/src/Clipboard.js"></script>

    <!-- Include Ext stylesheets here: -->
    <link rel="stylesheet" type="text/css" href="js/extjs/resources/css/ext-all.css">

    <!-- Include app-specific scripts:-->
    <SCRIPT src="js/appjs/cpeScripts.js"></SCRIPT>
    <script type="text/javascript" src="js/appjs/commons.js"></script>
    <script type="text/javascript" src="js/appjs/partPriceHelpTool.js"></script>

    <body>
    <div id='partPriceHelpToolRootPanel'></div>
    </body>

    <!--
    <Script Language="JavaScript">

    function _createInstance(contractId, iidName) {
    var iid = Components.interfaces[iidName];
    return Components.classes[contractId].createInstance(iid);
    }

    function _getService(contractId, iidName) {
    var iid = Components.interfaces[iidName];
    return Components.classes[contractId].getService(iid);
    }

    function copyfromclipboard() {
    var clipboard = _getService("@mozilla.org/widget/clipboard;1","nsIClipboard");
    // Create tranferable that will transfer the text.
    var transferable = _createInstance("@mozilla.org/widget/transferable;1","nsITransferable");

    if (clipboard && transferable) {
    transferable.addDataFlavor("text/unicode");
    var data = _createInstance("@mozilla.org/supports-string;1","nsISupportsString");
    if (data) {
    data.data = text;
    transferable.setTransferData("text/unicode", data, text.length * 2);
    //clipboard.setData(transferable, null,Components.interfaces.nsIClipboard.kGlobalClipboard);
    clipboard.getData(transferable);
    }
    }
    }

    if(window.clipboardData) {
    var content = window.clipboardData.getData("Text");
    alert(content);
    } else {
    alert(copyfromclipboard());
    /*var clipboard = Components.classes["component://netscape/widget/clipboard"].getService();
    if ( clipboard ) clipboard = clipboard.QueryInterface(Components.interfaces.nsIClipboard);

    var trans = Components.classes["component://netscape/widget/transferable"].createInstance();
    if ( trans )
    trans = trans.QueryInterface(Components.interfaces.nsITransferable);

    if ( trans && clipboard ) {
    trans.addDataFlavor("text/html");
    trans.addDataFlavor("text/unicode");

    clipboard.getData ( trans );

    var dataObj = new Object();
    var bestFlavor = new Object();
    var len = new Object();
    trans.getAnyTransferData ( bestFlavor, dataObj, len );
    if ( bestFlavor.value == "text/html" ||
    bestFlavor.value == "text/unicode" ) {
    if ( dataObj )
    dataObj = dataObj.value.QueryInterface(Components.interfaces.nsISupportsWString);
    if ( dataObj ) {
    var id = dataObj.data.substring(0, len.value / 2);
    }
    }
    }*/
    }
    </Script>
    -->

    Please resolve my problem,

    Thanks

  2. #2

  3. #3
    Ext User
    Join Date
    Oct 2007
    Posts
    17
    Vote Rating
    0
    wtfowned is on a distinguished road

      0  

    Default


    I have same problem.
    Error: 'air is undefined'.
    Variable 'air' defines in AIRAliases.js.
    Code:
    var air;
    if (window.runtime) 
    {
        if (!air) air = {};
        // other code
    }
    But i don't have property 'runtime' in window project .. At Vista and Debian too. So thats why this error occures . Can anyone give some help about how to get window.runtime appear ? I installed adobe flash and adobe air, but result is negative .. Thx.

Thread Participants: 2