The Video Object


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:

1.

Start a new Flash document.

2.

Open the library (Window, Library).

3.

Select the Options drop-down in the top right of the library and choose New Video.

4.

Select Video (ActionScript-controlled) and click OK.

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.

TIP

"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:

 myVideo_video.attachVideo(myStream_ns); 

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.




Macromedia Flash Professional 8 Unleashed
Macromedia Flash Professional 8 Unleashed
ISBN: 0672327619
EAN: 2147483647
Year: 2005
Pages: 319

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net