I've been playing around with the new IO a little bit and found that the serialization actually isn't done inside the Flash player but by these _javascript_ methods that the player injects into the document container when the first callback gets added:

function __flash__arrayToXML(obj) {
    var s = "<array>";
    for (var i=0; i<obj.length; i++) {
        s += "<property id=\"" + i + "\">" + __flash__toXML(obj[i]) + "</property>";
    }
    return s+"</array>";
}
function __flash__argumentsToXML(obj,index) {
    var s = "<arguments>";
    for (var i=index; i<obj.length; i++) {
        s += __flash__toXML(obj[i]);
    }
    return s+"</arguments>";
}
function __flash__objectToXML(obj) {
    var s = "<object>";
    for (var prop in obj) {
        s += "<property id=\"" + prop + "\">" + __flash__toXML(obj[prop]) + "</property>";
    }
    return s+"</object>";
}
function __flash__escapeXML(s) {
    return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
}
function __flash__toXML(value) {
   var type = typeof(value);
    if (type == "string") {
        return "<string>" + __flash__escapeXML(value) + "</string>";
    } else if (type == "undefined") {
        return "<undefined/>";
    } else if (type == "number") {
        return "<number>" + value + "</number>";

So, there's your serializer right there :) Alternatively, you could create your own COM container that implements the IHTMLDocument2 interface (to make the injecting work). Next, you could use the MS scripting host to have the code executed. That's a lot of hassle - so just porting the serializer is the way to go, I'd say.

Cheers,

Edwin van Rijkom
http://www.vanrijkom.org

Mike Chambers wrote:
It handles serialization with Flash / _javascript_ communication.

If you want Flash ->c# communication, then you will need to deserialize the
XML that Flash will spit out (xml-rpc like xml).

mike chambers

[EMAIL PROTECTED]

----- Original Message ----- 
From: "David Rorex" <[EMAIL PROTECTED]>
To: "Open Source Flash Mailing List" <[email protected]>
Sent: Wednesday, August 10, 2005 9:12 AM
Subject: Re: [osflash] Flash 8's External Interface - synchronous
projectors!


On 8/10/05, John Giotta <[EMAIL PROTECTED]> wrote:
  
[quote]
So, what the open source community should do is build a serialization /
deserialization library to abstract the XML format away.
[/quote]

XPathAPI would be good, no?

There is an API available in the Remoting Components or X Factor
Studios (http://www.xfactorstudio.com/Actionscript/AS2/XPath/)

    

Doesn't the ExternalInterface API already have
serialization/deserialization built in?
You can communicate with _javascript_ with native AS objects without
doing any serializing yourself...

-David R

_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org


_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org




  

_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to