Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import flash.utils.ByteArray;
- import flash.media.Video;
- import flash.net.NetConnection;
- import flash.net.NetStream;
- import flash.events.NetStatusEvent;
- var et:ET = new ET(stage, "MoreThanABird");
- [Embed(source="morethan.flv", mimeType="application/octet-stream")]
- var cls : Class
- var vbytes : ByteArray = new cls() as ByteArray;
- var video : Video = new Video(480, 360);
- video.smoothing = true;
- addChild(video);
- var nc : NetConnection = new NetConnection();
- nc.connect(null);
- var ns :NetStream;
- playVideo();
- function playVideo() {
- ns = new NetStream(nc);
- ns.client = {};
- ns.addEventListener(NetStatusEvent.NET_STATUS, nsNetStatus);
- video.attachNetStream(ns);
- ns.play(null);
- ns.appendBytes(vbytes);
- }
- function nsNetStatus(e:NetStatusEvent) {
- var code:String = e.info.code;
- if (code == "NetStream.Buffer.Empty") {
- ns.removeEventListener(NetStatusEvent.NET_STATUS, nsNetStatus);
- playVideo();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment