Patrick Mineault wrote:
Beatiful! Can't wait till someone picks it up and wraps it in C# or Java.
I already have a C# LocalConnection class, but I didn't want to share it
because I don't think MM wants internals of the Flash Player publically
available. At least, if it were me I wouldn't want people reverse
engineering my technology (not to mention the possible legal
implications)...
Reading the data from the LocalConnection was actually the easy part
(Claus had posted code to dump the shared memory a long time ago - over
a year ago, actually, so we've known how to read LC data for a long
time). The harder part was writing data to the LC and having Flash pick
it up, which your example doesn't seem to do.
Also, don't forget about domains - not all localconnections are "localhost".
Anyway, my C# API looks something like this:
LocalConnection lc = new LocalConnection();
lc.Connect("listening_connection", domain);
// listen for stuff from Flash
lc.AddMethod("log", new LocalConnectionMethod(this.Log));
// send stuff to flash
lc.Send("to_flash", "log", txtSend.Text);
// then..
private void Log(params object[] args) {
txtReceived.Text = args[0].ToString();
}
So whenever you call the "log" function for "listening_connection" from
flash, the C# method Log gets called, being passed all of the parameters
as an array ob objects (that you have to inspect to figure out their
actual types). As shown, you use the send method to send data to Flash,
though I think this would be better as a static method of the
LocalConnection class.
When you demonstrate how to send data to Flash from the LC, then perhaps
I'll contribute my C# code, but I'm not going to be the one to show how
to write data to the LC. Sorry for being political here, but I never
received the OK from Macromedia to show how I got my LC experiments to
work, and I wouldn't feel right revealing that information until it was
already public knowledge.
For those interested though, here's a captivate demo showing my working
C# demo: http://www.darronschall.com/lc/lc.cfm
-d
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org