
Chapter 460
Debugging NetConnection.Connect.Failed
If a
NetConnection.connect command returns an information object with a code value of
NetConnection.Connect.Failed, you are unable to establish a connection with the server.
Every time you receive this error, ask yourself some standard troubleshooting questions:
• Are you connecting to a valid application? In other words, is there a subdirectory in the
flashcom application directory that has the same name as the application? (This is a very
common reason for a connection to fail.)
• Are you connecting to the right server?
• Is the server running?
• Are you specifying the protocol (rtmp:) for connecting to the server?
Attempts to connect to the server can also fail if the permissible number of socket connections on
either the client or the server machine is at its limit. This limit is dependent on how much
physical memory your server has, and how busy the connections are. On Windows systems, the
memory for socket connections is allocated out of the non-paged memory, so it cannot be
swapped out to a page file. You may see that you reach the maximum limit at different values
from time to time as other running programs (such as core OS services) will be competing with
yours for space in the non-paged memory pool.
Getting properties of an object
If you need to know why you might be having problems with a particular object, you can iterate
its properties like this:
for (i in my_obj) {
trace(i + " = " + my_obj[i]);
}
Adding a privacy module
When creating applications that capture client audio or video streams, you should provide users
with explicit notice that you are doing so, and request their permission. Including a self-view is a
good way to let the user know that they are “on camera” and a transmission light or microphone
activity indicator can let that person know that the microphone is on. For live communication
applications it is always a good idea to give the user easy access to controls that allow them to turn
their camera and microphone off and to mute the audio they are receiving.
Many of the sample applications provided in the flashcom application directory illustrate how to
implement one or more of these techniques. The following sample shows one way to request the
user’s permission before recording. You can find the sample file for this code in the
flashcom_help\help_collateral\doc_approval directory under the installed Macromedia Flash MX
authoring directories.
To create the privacy module:
1 In the Flash MX authoring environment, select File > New to open a new file.
2 From the Components panel (Window > Components), drag the Push Button symbol under
Flash UI components to a position near the bottom of the Stage. In the Property inspector
(Window > Properties), give it the instance name
Record_btn, the label Record, and the click
handler
doRecord.
Commenti su questo manuale