-
VideoEvent.COMPLETE problems
Got a video object and on it I want a play button to appear after the video is completed ala YouTube. Tried the following code but got a 1046: Type was not found error instead. Here's my code:
--
import fl.video.VideoEvent;
stop();
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
myVid.attachNetStream(ns);
var listener:Object = new Object();
listener.onMetaData = function(md:Object):void {};
ns.client = listener;
play_btn.addEventListener(MouseEvent.CLICK, playVideo);
function playVideo(evt:MouseEvent):void {
play_btn.visible = false;
ns.play("video.flv");
}
myVid.addEventListener(fl.video.VideoEvent.COMPLET E, playAgain);
function playAgain(v:VideoEvent){
play_btn.visible = true;
}
Adam Bell
dzign@datatv.com
--
Over 90% of all websites
suck......
Join the minority.
-
have you imported the netstream and netconnection class?
-
plus, why are you making a listener when there is the addEventListener function?
you may also need to import the
Code:
fl.video.MetadataEvent;
class.
Dan
-
Well, that's what I'm trying to figure out. Do I need that extra listener? Or place the NetStream.Play.Complete inside of the same function?
Adam Bell
dzign@datatv.com
--
Over 90% of all websites
suck......
Join the minority.
-
ah - whoops.
looks like you do need that extra metadata listener other wise the app crashes. damn.
if I'm using the flvplayback component (which you could do if size is no object) then I just listen for videoEvent.COMPLETE and feed it an appropriate handler.
Dan
-
Well, I'd like to learn how to use it with the NetStream object instead of bringing in the larger FLV Playback Component.
Adam Bell
dzign@datatv.com
--
Over 90% of all websites
suck......
Join the minority.
-
-
The actionscript.org link did it for me. Thanks for the links.
Adam Bell
dzign@datatv.com
--
Over 90% of all websites
suck......
Join the minority.
-
Excellent, glad I could "help"....
Dan
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|