I made a video player that I saw in a tutorial one, now I intend to adapt in my use, my problem is the following one, when the film finish I would like it come to frame 2, thing that I am not obtaining to make.
Segue a AS.
stop ();
//--------NetConnection Setup---------
var videoNC:NetConnection = new NetConnection ();
videoNC.connect (null);
//--------NetStream Setup---------
var videoNS:NetStream = new NetStream (videoNC);
//
videoNS.onStatus = function (info) {
//trace(info.code);
if (info.code == "NetStream.Play.Start") {
barraCarregando_mc.onEnterFrame = videoUpdate;
}
if (info.code == "NetStream.Play.Stop") {
delete barraCarregando_mc.onEnterFrame;
}
};
var duration:Number;
videoNS["onMetaData"] = function (info) {
duration = info.duration;
};
//--------Attach NetConnection---------
video_flv.attachVideo (videoNS);
//--------Tocando FLV externo---------
videoNS.play ("video.flv");
//--------Botão Voltar---------
voltar_btn.onRelease = function () {
videoNS.seek (0);
};
//--------Botão Play e Pausar toggle---------
playpausa_mc.onRollOver = function () {
if (this._currentframe == 1) {
this.gotoAndStop ("pauseOver");
}
else {
this.gotoAndStop ("playOver");
}
};
playpausa_mc.onRollOut = function () {
if (this._currentframe == 10) {
this.gotoAndStop ("pause");
}
else {
this.gotoAndStop ("play");
}
};
playpausa_mc.onRelease = function () {
if (this._currentframe == 10) {
this.gotoAndStop ("playOver");
videoNS.pause (true);
}
else {
this.gotoAndStop ("pauseOver");
videoNS.pause (false);
}
};
verdeNovo_mc.onRelease = function () {
videoNS.seek (0);
};
//--------Barra de carregando---------
barra1_mc.onEnterFrame = function () {
this._xscale = (videoNS.bytesLoaded / videoNS.bytesTotal) * 100;
if (this._xscale == 100) {
delete this.onEnterFrame;
}
};
//--------Video Update---------
function videoUpdate () {
barraCarregando_mc._xscale = (videoNS.time / duration) * 100;
tempo_txt.text = tempodeFilme (videoNS.time);
}
//--------Arratar Barra---------
barra1_mc.onPress = function () {
barraCarregando_mc.onEnterFrame = arrastarBarra;
};
barra1_mc.onRelease = barra1_mc.onReleaseOutside = function () {
barraCarregando_mc.onEnterFrame = videoUpdate;
};
function arrastarBarra () {
var dist:Number = (_root._xmouse - barra1_mc._x) / barra1_mc._width;
videoNS.seek (Math.floor (duration * dist));
barraCarregando_mc._xscale = (videoNS.time / duration) * 100;
tempo_txt.text = tempodeFilme (videoNS.time);
}
//--------Tempo de filme---------
function tempodeFilme (theTime) {
var t:Number = Math.round (theTime);
var min:Number = Math.floor (t / 60);
var sec:Number = t % 60;
var s:String = "";
if (min < 10) {
s += "0";
}
if (min >= 1) {
s += min.toString ();
}
else {
s += "0";
}
s += ":";
if (sec < 10) {
s += "0";
s += sec.toString ();
}
else {
s += sec.toString ();
}
return s;
}
//--------Controle do som---------
this.createEmptyMovieClip ("videoSom", 2);
videoSom.attachAudio (videoNS);
var vSom:Sound = new Sound (videoSom);
vSom.setVolume (75);
somCarregando_mc._xscale = 75;
barraSom_mc.onPress = function () {
ajustandoSom ();
this.onMouseMove = ajustandoSom;
};
barraSom_mc.onRelease = barraSom_mc.onReleaseOutside = function () {
delete this.onMouseMove;
};
function ajustandoSom () {
var dist:Number = Math.floor (((_root._xmouse - barraSom_mc._x) / barraSom_mc._width) * 100);
if (dist >= 0 && dist <= 100) {
somCarregando_mc._xscale = dist;
vSom.setVolume (dist);
}
}