PDA

View Full Version : video Object and NetStream Help


Navarone
06-11-2004, 11:25 AM
I am trying to get my flv to play in my video object. So I have been following the Help files and I must not be doing something correct cause nothing is playing.

I added a new video object to my Library and renamed it "my_video" . I then draged it to the stage, set the size properties I needed 320x240 and gave it an instance name of "my_video". Then I attached this code straight from the Help file and changed the file name to play my flv.


var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(my_nc);
my_video.attachVideo(ns); // my_video is a Video object on the Stage
ns.play("Videos\Intro.flv");


When I test the movie in flash I don't see my video. I also published my flash project and tried playing the swf file but it still doesn't work.

What am I doing wrong? :)

chrisgannon
06-11-2004, 11:49 AM
You simply need to change the line:

var ns:NetStream = new NetStream(my_nc);

to

var ns:NetStream = new NetStream(nc);

It's a known error in the help.

Navarone
06-11-2004, 11:57 AM
Ok, I changed that per your suggestion, but I still don't see my video. :confused:


var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
my_video.attachVideo(ns); // my_video is a Video object on the Stage
ns.play("Videos\Intro.flv");


Hey, Navarone... AS tag is offline... Please use PHP tag instead... Thank you...

Navarone
06-11-2004, 02:46 PM
Ok, thanks for the tip. ;)

I read thru the help files and got things to work. However, I want to use the media controller and I don't think I understand how to link the controller to my_video.

I would use the Media Playback component, but I don't see anywhere how to adjust the size of the component. If I change the property values, it defaults back to the component's original size.

---

Oh... never mind. I think I figured that out too!

chrisgannon
06-17-2004, 05:43 AM
I have found that changing the AS 2.0-specific syntax from:

var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
my_video.attachVideo(ns); // my_video is a Video object on the Stage
ns.play("Videos\Intro.flv");

to

nc= new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
my_video.attachVideo(ns); // my_video is a Video object on the Stage
ns.play("Videos\Intro.flv");

makes it alot more stable - the var declaration along with the object type (:NetStream) seems to make it fail sometimes

oka_
07-15-2004, 11:14 PM
Also you might want to try using the line

ns.play("Videos\\Intro.flv");

Being able to actually find the file helps :)

-oka