4 Replies Latest reply on May 5, 2009 1:41 AM by Saka Nurudeen

    Use Ext JS and Adobe Air

    Saka Nurudeen Level 1

      Hi guys!

      Please, I want to use Adobe Air api in my Ext JS (a javascript library)  code.
      In my html file i wrote :
      <script type="text/javascript" src="AIRAliases.js"></script>
      <script type="text/javascript" src="./js/home/home_onready.js"></script>

      In file home_onready.js i call the function air.trace("toto"), but my console prints
      the following error message :
      TypeError: Undefined value
      [exec] buildDesktop at http://localhost:8080/G550/js/home/home_onready.js : 13

      How to resolve it ?

        • 1. Re: Use Ext JS and Adobe Air
          jbenson@oper8 Level 2

          A few questions:


          1:  Your source directory:  Any reason that it's referencing the js folder like "./js" as opposed to just src="js/home"? (I've had issues with that myself so just curious, unsure if it's related.)


          2:  Do references to the air namespace work outside of that file?   (IE in your html file can you call air.trace?)

          3:  Does window.runtime.trace('toto'); work as opposed to air.trace?

          4:  If none of the above could you post some code?

          • 2. Re: Use Ext JS and Adobe Air
            Saka Nurudeen Level 1

            1) My js directroy is surely a relative directory : it is a directory inside my application directory. In this directory I put all javascript files

               i wrote. All theses file have js extension.


            2) The entry point of my adobe air application is a file called index.html. In this file i included reference to AIRAlises.js and so i

                can use air api with no problem. But I load a second html file named home.html file. For this page, I includes in the head all javascript files

                of js directory and AIRAliases.js. In one of my javascript files : home_onready.js I defined a function to call air.trace('toto').  But it doesn't recognises

                this function.











                  A precision : index.html is phisically recorded in the disk but home.html dynamically generated by the sever and sent to browser of client.



            3) I tried window.runtime.trace('toto') with no success.

            • 3. Re: Use Ext JS and Adobe Air
              jbenson@oper8 Level 2

              Your JS source has src="./js" (notice the period and slash).  My point was you might just want to simplify with src="js".  (Both are relative etc.)  Again not sure if it's your culprit.


              What certainly could be your culprit is if you're dynamically loading home.html and then attempting to hit local resources from home.html like the javascript you mentioned.  You will not be able to do that by default unless you use a sandbox script bridge.  (Not being able to call window.runtime.trace is indicative of this.)


              Jeff has posted a good quickstart on that here:



              You should also look at the AIR help cross-scripting content in different security sandboxes here:

              http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7f08. html


              I hope that helps!


              1 person found this helpful
              • 4. Re: Use Ext JS and Adobe Air
                Saka Nurudeen Level 1

                Thanks for your help.

                I will try this solution.