Skip to main content
Participating Frequently
December 17, 2007
Question

MovieClip for FLV in AS 3.0

  • December 17, 2007
  • 6 replies
  • 695 views
Are there any examples out there on how to load an .flv file into a MovieClip in ActionScript 3.0.

It seems to have changed quite a bit from 2.0 - had MovieClip.attachMovie().

I've searched the net, and not found anything of substance.

I've tried using Loader to load an .flv file but get a #2124 error: Loaded file is an unknown type

Thanks!

dustoff.
This topic has been closed for replies.

6 replies

Participant
December 20, 2007
about stepping through the video, could'nt you seek forwards/backwards a time equal to that of each frame?
you can access the framrate and then calculate the time you need to seek to

the playhead time is in seconds, but has three decimals, which should be enough...
Participating Frequently
December 21, 2007
Allfader, thanks!

Good information to know that will help me out. For some reason I had it in my head that the seek parameter was an int.

Also, if it is not blazingly apparent yet, I should have set the "noob" flag in my initial posting - in red and bold...

dustoff.
Damon Edwards
Inspiring
December 17, 2007
no problem. you are welcome.
Damon Edwards
Inspiring
December 17, 2007
I suppose you could make a prototype, but that could get pretty involved.
Participating Frequently
December 17, 2007
Ok - I think I get it now.

My very intial question should have been "Can the MovieClip class read/load/process files of the FLV format".

I had gathered that in AS 2.0, it could.

I think that your last statement, about creating a prototype, implies "No - it cannot handle .flv" to the above question - in AS 3.0.

Thanks dzedward! I think I've pulled you into an unintentional game of "Clue" :)

dustoff.
Damon Edwards
Inspiring
December 17, 2007
you don't attach videos to MovieClips, you can attach a stream to a video object. As I said, use the NetStream/NetConnect method.


var vid:Video = new Video(320, 240); // size of video
addChild(vid);

var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);
vid.attachNetStream(ns);

var listener:Object = new Object();
listener.onMetaData = function(evnt:Object):void {}; // for retrieving your MetaData
ns.client = listener;

ns.play("myVideo.flv");
Participating Frequently
December 17, 2007
Thanks again for replying.

Forgive me for being so dense about this...

Is there a way with using NetStream and Video classes to advance frame by frame, as can be done in the MovieClip class with the nextFrame(), prevFrame() methods - NetStream has seek() method, but it appears to be by seconds - which seems to much of a span. Also, monitoring the current state of the Video Class - which seems to be in bytes vs frames. MovieClip status is by frame. Also Netstream.time property (position of the playhead) is in seconds.

Can frames be calculated via the byte type stats reported by NetStream. I guess what I'm trying to ask is, can everything that the MovieClip class does be done via NetStream/Video classes?

MovieClip just seems so much cleaner to use.

Thanks!

dustoff.
Inspiring
December 17, 2007
Dustoff,
I think you're looking for attachNetStream(). Here's the link to the adobe live docs.

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/media/Video.html#attachNetStream()

- N
Damon Edwards
Inspiring
December 17, 2007
use NetStream/NetConnect to display a FLV in a video object. Use the FLVPlayback component to display a FLV in the component. Use addChild() to attach something from the library. Lets say you give something a linkage id of 'myVideo', you would attach like this.

var myflv:myVideo = new myVideo();
addChild(myflv);
Participating Frequently
December 17, 2007
dzedward - thanks for replying.

I've just got the free 2.01 sdk, so I do not believe that I have the FLVPlayback. In my searching on the net, I've also saw posts in regards to FLVPlayback having a size gt 49k. I'm trying to keep my player size small. I do have an understanding of of how to get this working with just a video object - but it seems more limited than a MovieClip.

What I really want is to find out what bit of logic replaces MovieClip.attachVideo().

Thanks!

dustoff.