46
Using Media Classes
Handling events in a component-based application
When you develop applications, be aware that using components introduces explicit
onConnectAccept
and
onConnectReject
events. You need to include code to handle these
events. When you use components, you must modify the
application.onConnect
statement in your server-side code to include the
application.onConnectAccept
and
application.onConnectReject
event handlers. The last line (in order of execution) of your
onConnect
handler should be either
application.acceptConnection()
or
application.rejectConnection()
. If your application requires additional code following
the explicit
acceptConnection()
or
rejectConnection()
methods, such as a message
indicating that the user has been granted or denied permission to the application, you should
place that code in the
application.onConnectAccept
or
application.onConnectReject
statements.
Each component can have its own
application.onConnect
handler. By using
onConnectAccept
and
onConnectReject
, you can customize a component or create a new
one to implement authentication; for example, the code in a component could query a
database and decide to accept or reject a user based on the user name and password stored in
the database.
For more information about
application.onConnectAccept
and
application.onConnectReject
, see the
Server-Side ActionScript Language Reference
.
The Camera class
This section includes recommendations to help you optimize your use of the Camera class,
including tips for turning the camera off after recording, matching camera settings to available
bandwidth and using one camera in multiple applications.
Turning the camera off
If your application uses a Camera object attached to a NetStream object to record data, the
camera will stay on after you finish recording. To turn off the camera after recording, use the
NetStream.attachVideo(false)
method.
TIP
If you’re not using media components, you cannot use
application.onConnectAccept
and
application.onConnectReject
.
Summary of Contents for FLASH MEDIA SERVER 2-DEVELOPING MEDIA
Page 1: ...Developing Media Applications ...
Page 6: ...6 ...
Page 10: ...10 About This Manual ...
Page 36: ...36 Flash Media Server Architecture ...
Page 80: ...80 Debugging and Monitoring Applications ...
Page 106: ...106 Application Development Tips and Tricks ...
Page 114: ...114 ...