views:

651

answers:

2

Hi there:

I'm using Flex 3 in the UI of a Windows app (Flash player as an embedded ActiveX control), and passing data between them with ExternalInterface (primarily into the Flex app, as opposed to out). I'm finding, though, that the performance is pretty awful, particularly with larger (i.e., custom) objects; the more EI calls we make, and the larger the custom objects as pass in, the harder things seem to drop off performance-wise.

I'm assuming there's a good deal of overhead in serializing these objects, so I'm wondering, are there any best practices out there for using ExternalInterface in this particular way? There doesn't seem to be much out there in terms of documentation on this subject yet.

Is it better, say, to pass a large block of XML into the player control as a string, and parse it with Flex, than to pass it as a custom object, as a rule? How should Flex apps requiring a relatively tight integration with their host apps best use ExternalInterface without sacrificing performance? Is EI performance an issue Adobe is addressing? Any implementation differences between players 9 and 10? What kinds of things should we avoid to get the most out of this feature?

Thanks in advance!

Chris

+1  A: 

Just to share the answer with anyone who might be interested, the unofficial answer from Adobe (confirmed by a few Adobe engineers at last month's MAX conference) is that marshaling, say, over 30KB or so of data over ExternalInterface is going to cause performance degradation. Little bits of data, no problem -- but larger chunks, regardless of type, etc., will slow things down considerably.

Apparently it's a known issue, and Flash 10 doesn't seem to offer much in the way of improvements, unfortunately. So in the meantime, a workable solution is to use ExternalInterface for the little things, but to leave the heavier lifting to URLLoader and the XML or JSON parsers. Hope that helps -- if anyone runs into this one and needs more detailed guidance, feel free to contact me directly.

Christian Nunciato
+1  A: 

Brad Neuberg seems to have put a lot of effort to figure this one out. He has published a workaround at

http://codinginparadise.org/weblog/2006/02/how-to-speed-up-flash-8s.html