1 Reply Latest reply on Jun 10, 2007 8:30 PM by kapelletier

    ExternalInterface .NET Office Add-In

    kapelletier
      While I've been able to get ExternalInterface to work correctly in both directions (.NET to Flash/Flex and Flash/Flex to .NET) in a WinForms application, I can't get it to do the same when it is embedded in a UserControl inside of a Custom Task Pane in Office 2007 (Excel). I'm getting the very general E_Fail COM error. I used the IntrovertIM C# example from the help docs as a starting point. In fact, I'm using that ExternalInterface proxy.

      I'm having no problem calling out of Flex to the container (.NET UserControl), but when I call the methods exposed (via addCallback) in the Flex app. it doesn't work. As I said, it works fine in a WinForms app. But, in a Custom Task Pane, it doesn't seem to work. In Office 2007, your UserControl that makes up the Custom Task Pane is wrapped pretty deeply... control inside of control inside of control. Not sure if this is causing any issues.

      Has anybody else tried to do this? Has anyone had success? Not just with .NET WinForm to Flex integration, but with a UserControl? I do know it seems like an odd thing to do... but it will suit our approach nicely. I hope I can figure it out... I've already been able to do the same using WPF... but Flex seems like a better overall approach so I'd like to make this work. Any thoughts or links pointing me in the right direction will be much appreciated... So you know, I'm pretty new to Flex... which might have something to do with it as well... anyway... thanks in advance...

      Keith
        • 1. Re: ExternalInterface .NET Office Add-In
          kapelletier Level 1
          A little follow-up here... I just dropped a WebBrowserControl into my UserControl and pointed it at an HTML page where the Flex App./SWF was located. Then, I just use the Web Control as a proxy to Flex by way of JavaScript. See, .NET will talk to Script in the Web Browser via InvokeScript. Once in, it's easy to call into Flex via ExternalInterface. The other way is equally easy... call from Flex to JavaScript and then use window.external to call out to .NET methods in the Add-In.

          This works fine since the communication between the Flex in the Custom Task Pane need only be minimal. So, it works well enough. If anybody wanders onto a solution for the previous post, I'd love to hear it: kpelletier@elumindata.com.

          Keith