
Using Flash Communication Server MX 2004
199
To create a NetConnection object:
•
Use the
newObject()
method.
myNetConObject = sprite(1).newObject("NetConnection")
To 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.
To create a global NetConnection object that does not require a sprite reference:
•
Use the
newObject()
method and omit the sprite reference.
myNetConObject = newObject("NetConnection")
To 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)
To send text messages with the NetStream object:
•
Use the send method.
myStream.send(
handlerName
{,
p1
, ...,
pN
})
To send audio or video, you need to associate a camera and microphone with the
NetStream
object.
To associate a video camera with the NetStream object:
•
Use the ActionScript attachVideo method.
myStream.attachVideo(
source
)
To associate a microphone with the NetStream object:
•
Use the ActionScript attachAudio method.
myStream.attachAudio(
source
)
To publish a video, audio, or other data stream with the NetStream object:
•
Use the ActionScript publish method.
mystream.publish(
whatToPublish
)
To play a non-video data stream from the server with the NetStream object:
•
Use the ActionScript play method
mystream.play(
whatToPlay
)
To receive a video stream from the server, the stream must be attached to a video clip instance in a
Flash sprite. Sample Flash content containing a video clip object is included in the Macromedia/
Support/Flash/ folder on the Director installation CD.
To create a script reference to the video clip object in the Flash sprite:
•
Use the
getVariable()
method.
videoRef = sprite(1).getVariable(
nameOfFlashVideoClip
, FALSE)
Summary of Contents for DIRECTOR MX 2004-USING DIRECTOR
Page 1: ...DIRECTOR MX 2004 Using Director...
Page 16: ...16 Chapter 1 Introduction...
Page 82: ...82 Chapter 3 Sprites...
Page 98: ...98 Chapter 4 Animation...
Page 134: ...134 Chapter 5 Bitmaps...
Page 242: ...242 Chapter 10 Sound and Synchronization...
Page 274: ...274 Chapter 11 Using Digital Video...
Page 290: ...290 Chapter 12 Behaviors...
Page 302: ...302 Chapter 13 Navigation and User Interaction...
Page 334: ...334 Chapter 15 The 3D Cast Member 3D Text and 3D Behaviors...
Page 392: ...392 Chapter 16 Working with Models and Model Resources...
Page 418: ...418 Chapter 18 Movies in a Window...
Page 446: ...446 Chapter 22 Managing and Testing Director Projects...