Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 15. Using Third-Party Libraries ... > Adding video as a material on a 3D o...

Adding video as a material on a 3D object

Using video as a Papervision3D material is easy and very similar to using a movie clip asset. Instead of using the Papervision3D MovieAssetMaterial class, you use the VideoStreamMaterial class. In previous lessons, when you controlled video you used the FLVPlayback component. This very useful component can save a lot of coding; however, when you’re using video as a Papervision3D material, you may find it more efficient to bypass the FLVPlayback component and work with video using only ActionScript. To do this requires the use of three ActionScript classes that you have not been introduced to yet: the NetConnection class, the NetStream class, and the Video class.

About the NetConnection, NetStream, and Video classes

The NetConnection, NetStream, and Video classes work together to enable ActionScript to load and play video files and control them in many ways. An in-depth study of all three classes will yield a broad range of tools for working with streaming media.

You can think of a NetConnection instance as a large pipeline that enables multiple streams of content to flow into a compiled Flash file. After a NetConnection instance is established, NetStream instances send individual streams of content through the NetConnection instance. Each NetStream instance can, for example, contain one streaming video file. The NetStream class contains many properties and methods for controlling video.

The Video class extends the DisplayObject class and is basically a container for displaying video. After a video file is streamed into Flash using a NetStream instance, it can be displayed on the Stage using a Video instance.

Thus, the process of viewing streaming video with ActionScript in Flash is to create a NetConnection instance, send one or more NetStream instances through the NetConnection instance, and then display the streaming video data in a Video instance. In this lesson, you use these three classes to stream two distinct video files into Flash so that they can be used as Papervision3D materials.



  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial