Adding a video skin in AS3 - HELP!
i need add video skin "skinoverall.swf using as3. don't know as3 well. here code given use. much!
import flash.display.sprite;
import flash.events.*;
import flash.media.video;
import flash.net.netconnection;
import flash.net.netstream;
var videourl:string = "testfwa5.flv";
var connection:netconnection;
var stream:netstream;
playvideo();
function playvideo() {
trace("playvideo" + videourl);
connection = new netconnection();
connection.addeventlistener(netstatusevent.net_status, netstatushandler);
connection.addeventlistener(securityerrorevent.security_error, securityerrorhandler);
connection.connect(null);
}
function netstatushandler(event:netstatusevent):void {
switch (event.info.code) {
case "netconnection.connect.success" :
trace("netconnection.connect.success");
connectstream();
break;
case "netstream.play.streamnotfound" :
trace("unable locate video: ");
break;
case "netstream.play.stop" :
trace("video done");
movieclip(root).videoover();
break;
}
}
function connectstream():void {
stream = new netstream(connection);
stream.addeventlistener(netstatusevent.net_status, netstatushandler);
stream.addeventlistener(asyncerrorevent.async_error, asyncerrorhandler);
var video:video = new video();
video.attachnetstream(stream);
stream.play(videourl);
addchild(video);
video.width = 580; //this size of video boundry on stage
video.height = 403;
video.x = 0 - (video.width/2);
video.y = 0 - (video.height/2);
}
function securityerrorhandler(event:securityerrorevent):void {
trace("securityerrorhandler: " + event);
}
function asyncerrorhandler(event:asyncerrorevent):void {
// ignore asyncerrorevent events.
}
if want use flvplayback skin, should using flvplayback component play flv, not video instance.
More discussions in ActionScript 3
adobe
Comments
Post a Comment