topical media & game development
actionscript-video-09-masks-pro-VideoMC.ax
actionscript-video-09-masks-pro-VideoMC.ax
[swf]
flex
package FlashVideoPro
{
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.media.Video;
public class @ax-actionscript-video-09-masks-pro-VideoMC extends MovieClip {
private var nc:NetConnection;
private var ns:NetStream;
function @ax-actionscript-video-09-masks-pro-VideoMC() {
// Construct NetConnection
var nc:NetConnection = new NetConnection();
nc.connect(null);
// Flash is looking for an onMetaData method, route all calls to an object
var metaObject:Object = new Object();
metaObject.onMetaData = onMetaData;
// Construct NetStream and connect to flow through NetConnection
var ns:NetStream;
ns = new NetStream(nc);
ns.bufferTime = 3;
ns.play("video/trainride_512.flv");
// Route all onMetaData calls on NetStream to the metaObject
ns.client = metaObject;
// Construct video object with dimensions
var video:Video = new Video(240, 180);
video.attachNetStream(ns);
addChild(video);
video.x = 100;
video.y = 100;
}
private function onMetaData(data:Object):void {
// Satisfies Flash's need to send metadata with Flash Video
// This is considered to be a bug and may be fixed in the final AS3 release
}
}}
(C) Æliens
27/08/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.