2 Replies Latest reply on Aug 28, 2012 6:21 PM by DuoMi

    How to use ActiveXObject in AIR,or call js(with ActiveXObject) in AIR

    DuoMi

      How to use ActiveXObject in AIR,or call js(with ActiveXObject) in AIR

       

      I need call some JavaScript functions(with ActiveXObject call).

       

      i do this:

       

      html=new HTMLLoader();

      html.runtimeApplicationDomain = ApplicationDomain.currentDomain;

      html.addEventListener(Event.COMPLETE,aaa);

      html.load(new URLRequest("js.html"));

       

      public function aaa(evt:Event):void

      {

           html.window.getSomeDataFromActiveXObject();            //there will break

      }

       

      I got this resault:

       

      ReferenceError: Can't find variable: ActiveXObject.

       

       

      I think can't call JS with ActiveXObject in AIR......

       

      but I realy need to use ActiveXObject to get USB Key info . so, What should I do?

        • 1. Re: How to use ActiveXObject in AIR,or call js(with ActiveXObject) in AIR
          adobe_paul Adobe Employee

          The HTML engine that's included in AIR is based on WebKit, which doesn't run ActiveX controls. In addition, AIR has a restriction that you can't use any plugins within the HTML content except for Flash Player (which is bundled with AIR). Unfortunately I don't think there's any way to use the ActiveX object from HTML in AIR.

           

          Did you (or someone you know) create the ActiveX object? The only suggestion I can think of is to create a native extension (ANE) that performs the functionality of the ActiveX object, and use that ANE from your AIR app. (In fact, if you don't have access to the source of the ActiveX object you could probably create an ANE that uses the ActiveX object -- at least, long ago I wrote C# code that embedded the Flash Player ActiveX object so I'm guessing you could write a C# ANE that uses your ActiveX object.)

           

          Paul Robertson

          Adobe Developer Relations

          • 2. Re: How to use ActiveXObject in AIR,or call js(with ActiveXObject) in AIR
            DuoMi Level 1

            thank you very much , Paul .

             

            so, I will give up use ActiveX in HtmlLoader object.

             

             

            I will try to this way:

             

            call a php url in AIR------------------->use ActiveX in php page-------------------------->return a XML data to AIR

             

             

            I think that maybe work.