Flash
  Home arrow Flash arrow Page 2 - XML Sockets in Flash
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
FLASH

XML Sockets in Flash
By: Richard Lyman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 26
    2002-04-02

    Table of Contents:
  • XML Sockets in Flash
  • Methods and Properties
  • Common Utilizations
  • Possibilities
  • Summary

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    XML Sockets in Flash - Methods and Properties


    (Page 2 of 5 )

    I'll enumerate the different methods and properties that this object contains, and then explain common coding practices.

    close() - This method allows you to cleanly terminate an open socket from the client's end of communication.

    connect() - This method allows you to connect to a server running a socket server that is able to interpret the EOL character that is currently standard for Flash sockets (the ASCII null character, or '\0'). It will also eventually invoke the onConnect event-handler. This method accepts two parameters: a string as the URL of the server to connect to, and an integer as the port that the socket server is waiting on.

    send() - This method allows you to send a string of characters through the socket connection. While the string is usually in XML format it does not have to be. This string can either be constructed using the XML object within Flash, or manually if size permits. Flash will also automatically append the terminating null character for you.

    onConnect() - This event-handler is invoked either on success or failure for the connection attempt. It will return a Boolean based on the connections status (not to be confused with the 'status' property of a parsed XML object).

    onXML() - This event-handler is invoked upon receipt of a null character. When this event is triggered the data that was received since the last null character has already been parsed, and placed into a hierarchy that you can use to retrieve the data – again using the XML object in Flash.

    onData() - This event is similar to the onXML event, but it is triggered before any parsing. This allows for manual parsing or custom string handling (which can be quite useful as we’ll see near the end of this article).

    onClose() - This event is not as intuitive as it might seem. It is triggered when the server terminates the connection - not when the client terminates. This is generally used to handle an unexpected disconnection from the server.

    More Flash Articles
    More By Richard Lyman


       · Is there a closing bracket that's misplacing in the 2nd implementation...
     

    FLASH ARTICLES

    - Critical Flash Vulnerability Heats Up the Web
    - More on Nonpersistent Client-Side Remote Sha...
    - Nonpersistent Client-Side Remote Shared Obje...
    - Using the Decorator Pattern for a Real Web S...
    - Using Concrete Decorator Classes
    - Delving More Deeply into the Decorator Patte...
    - The Decorator Pattern in Action
    - A Simple Decorator Pattern Example
    - Decorator Pattern
    - Organizing Frames and Layers for Flash Anima...
    - Organizing Frames and Layers
    - Using XML and ActionScript with Flex Applica...
    - Interfaces and Events with ActionScript and ...
    - Manipulating Data with ActionScript in Flex ...
    - ActionScript Syntax for Flex Applications







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    Stay green...Green IT