PDA

View Full Version : ExternalInterface with C#



rmj134
July 18th, 2007, 04:04 PM
hey everyone. I am trying to use ExternalInterface in a C# wrapper. I can get ActionScript to talk to C#, but not the other way around. I know everyone is going to say I need to declare the ActionScript function first. Believe me, I did.

I also tried using the activeX dll files from 2003 to no avail.

I've seen other people with the same problem, but never a solution. It seems the only people who have gotten this to work BOTH ways are the people publishing from FLEX.

Is this just coincidence?

CarlLooper
July 18th, 2007, 06:27 PM
Caution - I'm only speculating here -

What you might like to try is ensuring your root display object is specified entirely in Actionscript - and put your External interface code in that.

Save the following as "MyRoot.as" (in the same folder as your fla file)



package
{
import flash.display.Sprite;
// ...

public class MyRoot extends Sprite
{
public function MyRoot()
{
// ...
}
// ...
}
}
In Flash specify this file as your "Document class". You can do this by clicking on stage and looking at propertys panel - you'll see a window (bottom right) where you can type in the name of the above class: MyRoot.

MyRoot will now be your root display object and hopefully free of any side effects that Flash authoring might be introducing ...

Carl