The Video Object
Although you may not have known it, we already created one video object when we imported the video into Flash. Video objects do more than that, though; they allow developers to display video streaming from external sources. To do this, you have to create a blank video object.
Follow these steps to create a new blank video object:
Now if you want to use it, just drag it out onto the stage and give it an instance name so that you can refer to it in ActionScript.
"video" is the suffix for video object instances that will automatically open code hints.
And that was ityou now have a blank video object on the stage.
The Video object has a few methods and properties, but the one we will be using is the attachVideo() method.
The attachVideo() Method
The attachVideo() method allows video being streamed to a NetStream object to be viewed on the stage. You can also set a Camera object to it (more on the Camera object later in this chapter).
The generic layout to attach a NetStream to a Video object is as follows:
The only parameter passed is the NetStream object being displayed.
We have covered a lot of code that shows how to create a video stream. Now let's put it all together.