XML Sockets in Flash - Summary
(Page 5 of 5 )
All in all the XMLSocket object allows for an increased vocabulary between clients and/or server. This allows the developer to bring about more dynamic ‘real-time-capable’ data. The XMLSocket object also facilitates the transferal of information from storage to use. The XMLSocket object is only one of many methods available for this transferal, yet it’s advantages give the developer an increased range of motion in delivering that data to the client.
There are precautions that need to be taken, as Flash does not currently support encoding of a robust nature. There are Flash developers who have scripted objects that deal with MD5 encryption, yet they tend to be bulky, and unwieldy. Care must also be taken when addressing issues of usability in Animated representation of data. The Flash Player version 5 needs code snippets to deal with a loss of frame rate when parsing larger XML documents, yet the Flash Player 6 Beta release does not.
Attention should also be focused on the structuring of the XML document or string that is to be sent to Flash. Flash tends to favor less parent/child node structure, and more an attribute type of structure. For instance, the string:
<top>
<firstChild>
<insideDescription1>
Text1
</insideDescription1>
</firstChild>
<secondChild>
<insideDescription2>
Text2
</insideDescription2>
</secondChild>
</top>
Would be better defined like this:
<top>
<firstChild type=’insideDescription1’ text=’TEXT1’/>
<secondChild type=’insideDescription2’ text=’TEXT2’/>
</top>
if at all possible. There are circumstances that do not allow for this style of structure, but it should be used if it can.
It should also be remembered that Flash does not have to accept only XML formatted data. By using the ‘onData()’ event handler we can process other forms of information. Why send a string like this:
<top>
<xPosition>
234
</xPosition>
<yPosition>
34
</yPosition>
<zPosition>
4
</zPosition>
</top>
When the string: “234|34|4” would more than suffice? The XMLSocket does not use ‘headers’ like standard HTML does, nor does it require bulky tag explanations if you don’t want it to. The joy in the XMLSocket implementation is that you can define your data anyway you wish and display it from your server to anywhere you can squeeze Flash!
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |