The steps required to communicate with Flash Communication Server MX are identical to those
you would use in ActionScript.
To create a NetConnection object:
•
Use the Lingo
myNetConObject = sprite(1).newObject("NetConnection")
To create a NetStream object:
•
Use the
newObject()
myStream = sprite(1).newObject("NetStream", myNetConObject)
The
object can send text messages without the need for a Flash sprite on the Stage.
NetStream
To create a global NetConnection object that does not require a sprite reference:
•
Use the Lingo
myNetConObject = newObject("NetConnection")
To create a global NetStream object that does not require a sprite reference:
•
Use the
newObject()
omit the sprite reference:
myStream = newObject("NetStream", myNetConObject)
To send text messages with the NetStream object:
•
Use the send command.
myStream.send(handlerName {,p1, ...,pN})
To send audio or video, you need to associate a camera and microphone with the
object.
NetStream
To associate a video camera with the NetStream object:
•
Use the ActionScript attachVideo command.
myStream.attachVideo(source)
To associate a microphone with the NetStream object:
•
Use the ActionScript attachAudio command.
myStream.attachAudio(source)
To publish a video, audio, or other data stream with the NetStream object:
•
Use the ActionScript publish command.
mystream.publish(whatToPublish)
To play a non-video data stream from the server with the NetStream object:
•
Use the ActionScript play command
mystream.play(whatToPlay)
310
Chapter 11
command.
newObject()
command and include the
command and omit the sprite reference.
newObject()
command and include the
object as a parameter:
NetConnection
object as a parameter, and
NetConnection