效果图;

import mx.utils.Delegate;
import flash.net.FileReference;
var conn:NetConnection = new NetConnection();
conn.connect(null);
var net:NetStream = new NetStream(conn);
net.setBufferTime(3);
caman.attachVideo(net);
net.onStatus = function(info) {
trace(info.code);
if (info.code == "NetStream.Play.Stop") {
//是否播放完毕;
play_next = true;
//先设置为真,以便后面来触发下一首;
if (play_next) {
playFlv(1);
}
}
};
net["onMetaData"] = Delegate.create(this, net_duration);
function net_duration(object) {
Duration = object.duration;
}
function playFlv(num:Number) {
i += num;
if (i>=mArray.length) {
i = 0;
}
if (i<0) {
i = mArray.length-1;
}
Pp.gotoAndStop(1);
loaded = true;
flv = mArray[i].attributes.url;
net.play(flv);
T = setInterval(loading, 100);
}
function loading() {
loadingbar.playT._width = int(net.time/Duration*86);
//86是loadingbar._width,很奇怪,动态他求不出来;
setV._x = loadingbar._x+loadingbar.playT._width+2;
var c:Number;
if (loaded) {
var a = net.bytesLoaded;
var b = net.bytesTotal;
c = int(a/b*100);
trace(a);
loadingbar.gotoAndStop(c);
}
if (c>99) {
trace("oK");
loaded = false;
}
}
//下面为加载xml文件;
var i = 0;
var mArray:Array = new Array();
var xml:XML = new XML();
var T;
var Duration;
var netOpen:Boolean = true;
var loaded:Boolean = true;
//用来测量下载量的setInterval变量;
var fileRef:FileReference = new FileReference();
xml.ignoreWhite = true;
xml.onLoad = function() {
mArray = xml.firstChild.childNodes;
trace(mArray.length);
playFlv(0);
};
xml.load("list.xml");
//下面为按钮事件;
Pp.onPress = function() {
curfr = Pp._currentframe == 1 ? 2 : 1;
Pp.gotoAndStop(curfr);
if (netOpen != true) {
playFlv(0);
netOpen = true;
} else {
net.pause();
}
};
Stop.onPress = function() {
net.close();
netOpen = false;
pp.gotoAndStop(2);
};
Pref.onPress = function() {
playFlv(-1);
};
Next.onPress = function() {
playFlv(1);
};
Open.onPress = function() {
if (fileRef.browse([{description:"FLV Movies", extension:" .flv"}])) {
trace(fileRef.name);
}
};
//
my_cm = new ContextMenu();
my_cm.hideBuiltInItems();
my_cm.customItems.push(new ContextMenuItem("说明", ShowWin));
_root.menu = my_cm;
function ShowWin() {
var crl:MovieClip = _root.createEmptyMovieClip("crl", getNextHighestDepth());
crl.useHandCursor = false;
with (crl) {
_x = Stage.width/6;
_y = Stage.height/3;
attachMovie("show","crl",100);
}
crl.onPress = function() {
_this = this;
onEnterFrame = function () {
_this._alpha -= 5;
if (_this._alpha<0) {
delete this.onEnterFrame;
_this.removeMovieClip();
}
};
};
}

import mx.utils.Delegate;
import flash.net.FileReference;
var conn:NetConnection = new NetConnection();
conn.connect(null);
var net:NetStream = new NetStream(conn);
net.setBufferTime(3);
caman.attachVideo(net);
net.onStatus = function(info) {
trace(info.code);
if (info.code == "NetStream.Play.Stop") {
//是否播放完毕;
play_next = true;
//先设置为真,以便后面来触发下一首;
if (play_next) {
playFlv(1);
}
}
};
net["onMetaData"] = Delegate.create(this, net_duration);
function net_duration(object) {
Duration = object.duration;
}
function playFlv(num:Number) {
i += num;
if (i>=mArray.length) {
i = 0;
}
if (i<0) {
i = mArray.length-1;
}
Pp.gotoAndStop(1);
loaded = true;
flv = mArray[i].attributes.url;
net.play(flv);
T = setInterval(loading, 100);
}
function loading() {
loadingbar.playT._width = int(net.time/Duration*86);
//86是loadingbar._width,很奇怪,动态他求不出来;
setV._x = loadingbar._x+loadingbar.playT._width+2;
var c:Number;
if (loaded) {
var a = net.bytesLoaded;
var b = net.bytesTotal;
c = int(a/b*100);
trace(a);
loadingbar.gotoAndStop(c);
}
if (c>99) {
trace("oK");
loaded = false;
}
}
//下面为加载xml文件;
var i = 0;
var mArray:Array = new Array();
var xml:XML = new XML();
var T;
var Duration;
var netOpen:Boolean = true;
var loaded:Boolean = true;
//用来测量下载量的setInterval变量;
var fileRef:FileReference = new FileReference();
xml.ignoreWhite = true;
xml.onLoad = function() {
mArray = xml.firstChild.childNodes;
trace(mArray.length);
playFlv(0);
};
xml.load("list.xml");
//下面为按钮事件;
Pp.onPress = function() {
curfr = Pp._currentframe == 1 ? 2 : 1;
Pp.gotoAndStop(curfr);
if (netOpen != true) {
playFlv(0);
netOpen = true;
} else {
net.pause();
}
};
Stop.onPress = function() {
net.close();
netOpen = false;
pp.gotoAndStop(2);
};
Pref.onPress = function() {
playFlv(-1);
};
Next.onPress = function() {
playFlv(1);
};
Open.onPress = function() {
if (fileRef.browse([{description:"FLV Movies", extension:" .flv"}])) {
trace(fileRef.name);
}
};
//
my_cm = new ContextMenu();
my_cm.hideBuiltInItems();
my_cm.customItems.push(new ContextMenuItem("说明", ShowWin));
_root.menu = my_cm;
function ShowWin() {
var crl:MovieClip = _root.createEmptyMovieClip("crl", getNextHighestDepth());
crl.useHandCursor = false;
with (crl) {
_x = Stage.width/6;
_y = Stage.height/3;
attachMovie("show","crl",100);
}
crl.onPress = function() {
_this = this;
onEnterFrame = function () {
_this._alpha -= 5;
if (_this._alpha<0) {
delete this.onEnterFrame;
_this.removeMovieClip();
}
};
};
}
回复Comments
{commenttime}{commentauthor}
{CommentUrl}
{commentcontent}