How can Loading video files in AS3?



How can Loading video files in AS3?..

Answer / dindayal dhakar

Loading videos using the NetStream and NetConnection
classes is a multistep process:
1. The first step is to create a NetConnection object.
The NetConnection class lets you play streaming FLV files
from either an HTTP address or a local drive by passing the
value null to the connect() method, if you are connecting
to a local FLV file that is not using a server such as
Adobe's Flash Media Server 2 or Adobe Flex.
2. var nc:NetConnection = new NetConnection();
3. nc.connect(null);
4. The second step is to create a NetStream object
which takes a NetConnection object as a parameter and
specify which FLV file you want to load. The following
snippet connects a NetStream object to the specified
NetConnection instance and loads an FLV named video.flv in
the same directory as the SWF file:
5. var ns:NetStream = new NetStream(nc);
6. ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR,
asyncErrorHandler);
7. ns.play("video.flv");
8. function asyncErrorHandler
(event:AsyncErrorEvent):void
9. {
10. // ignore error
11. }
12. The third step is to create a new Video object and
attach the previously created NetStream object using the
Video class's attachNetStream() method. Then you can add
the video object to the display list using the addChild()
method, as seen in the following snippet:
13. var vid:Video = new Video();
14. vid.attachNetStream(ns);
addChild(vid);

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More Scripts AllOther Interview Questions

what will this do? function show_alert value="Show User" eval("x=10; y=20; document.write(x*y)");

1 Answers  


what is the diff between ANT and MAVEN?

2 Answers   Accenture,


'IMP' is not recognized as an internal or external command, operable program or batch file. this is the error message i am getting when i importing dmp for the backup. where is the problem?

3 Answers   Mobilink,


How can Loading video files in AS3?

1 Answers  


Someone who protect my excel file, m using ms office 2007 and windows 7 operating system, pls help me, how can i unprotect sheet

0 Answers  


What is a Scripting Language?

2 Answers  


In the Web page we have a table link, if we click on that link all the contents under that link will be sorted (asscending/Descending). Now i want to check in which order the list is ? for that i need to get the data in to some var How can i get that cells data?

1 Answers   Nous,


what is Eventflow.?

1 Answers  


How can we return a value from User Defined Function ? For Eg. we have 2 functions. In Fun1 i am getting 2 values (a,b) and i am addding those 2 and storing in to another var (c). Now i want to pass that var(c) to another function (fun2). What will be the script?

6 Answers   Nous,


what is difference between AS2 and AS3.?

6 Answers  


We have 1 web page with names column. I am giving the Service Providers1,2,3.... @ that time dynamically some no of names are displaying in the webpage and The Pop up windows are opening(No.of Pop Up windows=No.of Names). The names may be diffar for each and every Service Provders (Dynamically) How can we handle the Dynamic values?

0 Answers   Nous,


how can we move to the next column in excel sheet in file operation using descriptive programming inQTP?

0 Answers   HP,


Categories