ADOBE DIRECTOR 11.0
User Guide
209
sendSprite (1, #closeConnection)
You might also use the
close()
method in an
endSprite
handler as follows:
on endSprite (me)
pLocalConn.close()
end endSprite
The local connection object is now set up; has handlers for callbacks, sending messages, and closing the connection;
and is ready to be used by the movie.
Using Flash Media Server
Flash Media Server allows Flash content on separate computers to share information, including sound, video, text,
and other data in real time. Use Flash Media Server in Director by using Flash cast members that are designed to
work with the server, or by creating
NetConnection
and
NetStream
objects in script that you use to communicate
with the server.
As with any Flash ActionScript object you create by using script, use the exact same methods and properties to
manipulate the object as you would in ActionScript. For a detailed example, see
Using the Flash local connection
object
. The Adobe Director installation CD for Windows includes Flash Media Server, the Flash Media Server
authoring components for Flash, and documentation. The Adobe Director installation CD for Mac includes the
Flash Media Server authoring components for Flash and documentation.
The steps required to communicate with Flash Media Server are identical to those you would use in ActionScript.
Create a NetConnection object
•
Use the
newObject()
method.
myNetConObject = sprite(1).newObject("NetConnection")
Create a NetStream object
•
Use the
newObject()
method and include the
NetConnection
object as a parameter:
myStream = sprite(1).newObject("NetStream", myNetConObject)
The
NetStream
object can send text messages without the need for a Flash sprite on the Stage.
Create a global NetConnection object that does not require a sprite reference
•
Use the
newObject()
method and omit the sprite reference:
myNetConObject = newObject("NetConnection")
Create a global NetStream object that does not require a sprite reference
•
Use the
newObject()
method and include the
NetConnection
object as a parameter and omit the sprite
reference:
myStream = newObject("NetStream", myNetConObject)
Send text messages with the NetStream object
•
Use the send method.
myStream.send(handlerName {,p1, ...,pN})
To send audio or video, associate a camera and microphone with the
NetStream
object.