# Using win32ole to access the Flash ExternalInterface API?

**URL:** https://rubytalk.org/t/using-win32ole-to-access-the-flash-externalinterface-api/35734
**Category:** ruby-talk
**Created:** [28 February 2007 11:48 UTC](https://rubytalk.org/t/using-win32ole-to-access-the-flash-externalinterface-api/35734 "2007-02-28T11:48:32Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Peter\_Motzfeldt](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@Peter\_Motzfeldt](https://rubytalk.org/u/Peter_Motzfeldt)
#### Post date: [28 February 2007 11:48 UTC](https://rubytalk.org/t/using-win32ole-to-access-the-flash-externalinterface-api/35734/1 "2007-02-28T11:48:32Z")

</div>

Hi

I am working on a master thesis at Norwegian University of Science and  
Technology, and I am trying to create a open source framework for  
functional testing of Flex applications. And I want to do it in Ruby.

I am playing with the ExternalInterface API for Flash applications. With  
this API it is possible to define methods, which will be visible through  
activex.

This is shown in the example in the link below  
[http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs\_Book\_Parts&file=19\_External\_Interface\_178\_5.html](http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&file=19_External_Interface_178_5.html)

This example uses C#, but I was thinking it should be possible with the  
use of win32ole.

I am able to reach the movie object with win32ole, but I don't know how  
to be able to call the methods created in the Flex application.

I am not that familiar with the win32ole, but can it work as a activex  
control, or do I need something else?

Thank you for any advice!

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

### Author: ![rza.south](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@rza.south](https://rubytalk.org/u/rza.south)
#### Post date: [1 March 2007 15:00 UTC](https://rubytalk.org/t/using-win32ole-to-access-the-flash-externalinterface-api/35734/2 "2007-03-01T15:00:06Z")

</div>

It's very simple really, you just instantiate a Ruby object to the  
WIN32OLE interface of the native API, then call the native API's  
methods as methods of the object you've just created. Example:

&nbsp;&nbsp;require 'win32ole'

&nbsp;&nbsp;param1 = 0  
&nbsp;&nbsp;param2 = 'test'

&nbsp;&nbsp;interface = WIN32OLE.new('registered\_OLE\_API\_here')  
&nbsp;&nbsp;interface.NativeMethodReqIntAndString(param1, param2)

&nbsp;&nbsp;nativeObj = interface.ReturnSomeObject  
&nbsp;&nbsp;nativeObj.ObjectNativeMethod

&nbsp;&nbsp;interface.NativeMethodReqNativeObj(nativeObj)

This is a trivial example, but shows how you can instantiate and use  
native objects using the win32ole interface, and how you can pass them  
back to the native API as method parameters.

Hope this helps,  
--Kris

> **···**
>
> On Feb 28, 6:48 am, Peter Motzfeldt \<pmo...@hotmail.com\> wrote:
> 
> > Hi
> > 
> > I am working on a master thesis at Norwegian University of Science and  
> > Technology, and I am trying to create a open source framework for  
> > functional testing of Flex applications. And I want to do it in Ruby.
> > 
> > I am playing with the ExternalInterface API for Flash applications. With  
> > this API it is possible to define methods, which will be visible through  
> > activex.
> > 
> > This is shown in the example in the link belowhttp://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/ww...
> > 
> > This example uses C#, but I was thinking it should be possible with the  
> > use of win32ole.
> > 
> > I am able to reach the movie object with win32ole, but I don't know how  
> > to be able to call the methods created in the Flex application.
> > 
> > I am not that familiar with the win32ole, but can it work as a activex  
> > control, or do I need something else?
> > 
> > Thank you for any advice!
> > 
> > --  
> > Posted viahttp://www.ruby-forum.com/.
