03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - 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.

onStatus (LocalConnection.onStatus h<strong>and</strong>ler)<br />

onStatus = function(infoObject:Object) {}<br />

Invoked after a sending LocalConnection object tries to send a comm<strong>and</strong> to a receiving<br />

LocalConnection object. If you want to respond to this event h<strong>and</strong>ler, you must create a<br />

function to process the information object sent by the LocalConnection object.<br />

If the information object returned by this event h<strong>and</strong>ler contains a level value of status, Flash<br />

successfully sent the comm<strong>and</strong> to a receiving LocalConnection object. This does not mean<br />

that Flash successfully invoked the specified method of the receiving LocalConnection object;<br />

it means only that Flash could send the comm<strong>and</strong>. For example, the method is not invoked if<br />

the receiving LocalConnection object doesn't allow connections from the sending domain or<br />

if the method does not exist. The only way to know for sure if the method was invoked is to<br />

have the receiving object send a reply to the sending object.<br />

If the information object returned by this event h<strong>and</strong>ler contains a level value of error, Flash<br />

cannot send the comm<strong>and</strong> to a receiving LocalConnection object, most likely because there is<br />

no receiving LocalConnection object connected whose name corresponds to the name<br />

specified in the sending_lc.send() comm<strong>and</strong> that invoked this h<strong>and</strong>ler.<br />

In addition to this onStatus h<strong>and</strong>ler, Flash also provides a "super" function called<br />

System.onStatus. If onStatus is invoked for a particular object <strong>and</strong> there is no function<br />

assigned to respond to it, Flash processes a function assigned to System.onStatus if it exists.<br />

In most cases, you implement this h<strong>and</strong>ler only to respond to error conditions, as shown in<br />

the following example.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 6<br />

Parameters<br />

infoObject:Object - A parameter defined according to the status message. For details about<br />

this parameter, see the Description section.<br />

Example<br />

The following example displays a status message about whether the SWF file connects to<br />

another local connection object called lc_name. A TextInput component called name_ti, a<br />

TextArea instance called status_ta <strong>and</strong> a Button instance called send_button are used to<br />

display content.<br />

var sending_lc:LocalConnection;<br />

var sendListener:Object = new Object();<br />

sendListener.click = function(evt:Object) {<br />

LocalConnection 735

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

Saved successfully!

Ooh no, something went wrong!