03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Establishes a connection to the specified Internet host by using the specified TCP port <strong>and</strong><br />

returns true or false, depending on whether a connection is successfully initiated. If the<br />

XMLSocket.connect() method returns a value of true, the initial stage of the connection<br />

process is successful; later, the XMLSocket.onConnect() method is invoked to determine<br />

whether the final connection succeeded or failed. If XMLSocket.connect() returns false, a<br />

connection could not be established.<br />

If you do not know the port number of your Internet host computer, contact your network<br />

administrator. To connect an XMLSocket to a port lower than 1024, you must first load a<br />

policy file with the System.security.loadPolicyFile() method.<br />

If you specify null for the host parameter, the host contacted is the one where the SWF file<br />

calling XMLSocket.connect() resides. For example, if the SWF file was downloaded from<br />

www.example.com, specifying null for the host parameter is the same as entering the IP<br />

address for www.example.com.<br />

In SWF files of any version running in Flash Player 7 or later, the host parameter must be in<br />

exactly the same domain. For example, a SWF file at www.someDomain.com that is<br />

published for Flash Player 5, but is running in Flash Player 7 or later can load variables only<br />

from SWF files that are also at www.someDomain.com. If you want to load variables from a<br />

different domain, you can place a cross-domain policy file on the server hosting the SWF file<br />

that is being accessed.<br />

Note: The XMLSocket.connect() method returns false if<br />

System.capabilities.hasXMLSocket is false.<br />

Parameters<br />

url:String - String; A fully qualified DNS domain name or an IP address in the form<br />

aaa.bbb.ccc.ddd. You can also specify null to connect to the host server on which the SWF file<br />

resides. If the SWF file issuing this call is running in a web browser, the host parameter must<br />

be in the same domain as the SWF file.<br />

port:Number - Number; The TCP port number on the host used to establish a connection.<br />

Returns<br />

Boolean - A value of true if the connection is successful; false otherwise.<br />

Example<br />

The following example uses the XMLSocket.connect() method to connect to the host where<br />

the SWF file resides <strong>and</strong> uses the trace() function to display the return value indicating the<br />

success or failure of the connection:<br />

var socket:XMLSocket = new XMLSocket()<br />

XMLSocket 717

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!