Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/09/2006, 19:51
ldr
 
Fecha de Ingreso: enero-2005
Mensajes: 32
Antigüedad: 19 años, 3 meses
Puntos: 0
loop en video??

Tengo este codigo para reproducir un video pero no vuelve a empezar, alguien sabe donde esta el error??

GRACIASS


!_root.file ? file="video.flv" : file=_root.file;
!_root.showFs ? showFs=false : showFs=_root.showFs;
!_root.autoStart ? autoStart=true : autoStart=_root.autoStart;

Stage.scaleMode = "noScale";
Stage.align = "CC";
Stage.showMenu = false;
bw = 0;

nc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
ns.setBufferTime(5);

function resizeIt(w, h) {
videoDisplay._width = w;
videoDisplay._height = h;
videoDisplay._x = 150-w/2;
videoDisplay._y = 150-h/2;

myX = videoDisplay._x;
myY = videoDisplay._y+videoDisplay._height;
myW = videoDisplay._width;

leftBg._x = myX-2;
leftBg._y = myY+2;
playBut._x = pauseBut._x=myX+10;
playBut._y = pauseBut._y=myY+12;

centerBg._x = percentBar._x=progressBar._x=backBar._x=myX+19;
centerBg._y = myY+2;
percentBar._y = progressBar._y=myY+10;
bw = centerBg._width=percentBar._width=progressBar._wid th=myW-39;
rightBg._x = myX+myW-20;
rightBg._y = myY+2;
muteBut._x = unmuteBut._x=myX+myW-10;
muteBut._y = unmuteBut._y=myY+12;
}
ns.onMetaData = function(obj) {
this.totalTime = obj.duration;

if (obj.width != 0) {
resizeIt(obj.width, obj.height);
}
};
ns.onStatus = function(object) {
if (object.code == "NetStream.Play.Start") {
if (videoDisplay.width != 0) {
resizeIt(videoDisplay.width, videoDisplay.height);
}
} else if (object.code == "NetStream.Buffer.Full") {
if (videoDisplay.width != 0 && fs != true) {
resizeIt(videoDisplay.width, videoDisplay.height);
}
} else if (object.code == "NetStream.Play.Stop") {
ns.seek(0);
ns.pause();
playBut._visible = true;
pauseBut._visible = false;
}
};

videoDisplay.attachVideo(ns);
ns.play(file);

this.createEmptyMovieClip("snd", 0);
snd.attachAudio(ns);
audio = new Sound(snd);
unmuteBut._visible = false;

muteBut.onPress = function() {
audio.setVolume(0);
unmuteBut._visible = true;
this._visible = false;
};

unmuteBut.onPress = function() {
audio.setVolume(100);
muteBut._visible = true;
this._visible = false;
};

if (autoStart == true) {
playBut._visible = false;
} else {
pauseBut._visible = false;
ns.seek(0);
ns.pause();
}

pauseBut.onPress = function() {
ns.pause();
playBut._visible = true;
this._visible = false;
};

playBut.onPress = function() {
ns.pause();
pauseBut._visible = true;
this._visible = false;
};

percentBar.onEnterFrame = function() {
loaded = this._parent.ns.bytesLoaded;
total = this._parent.ns.bytesTotal;
if (loaded == total && loaded>1000) {
percentBar._width = bw;
delete this.onEnterFrame;
} else {
percentBar._width = int(bw*loaded/total);
}
};

progressBar.onEnterFrame = function() {
this._width = bw*ns.time/ns.totalTime;
};

centerBg.onPress = function() {
this.onEnterFrame = function() {
scl = this._xmouse*this._xscale/bw/100;
ns.seek(scl*ns.totalTime);
};
};

centerBg.onRelease = centerBg.onReleaseOutside=function () {
delete this.onEnterFrame;
pauseBut._visible == false ? videoDisplay.pause() : null;
};

fsBut._y = 154-Stage.height/2;
fsBut._x = Stage.width/2+132;
if (showFs == false) {
fsBut._visible = false;
}

myListener = new Object();
myListener.onResize = function() {
fsBut._y = 154-Stage.height/2;
fsBut._x = Stage.width/2+132;
};
Stage.addListener(myListener);

fsBut.onPress = function() {
oldw = videoDisplay._width;
oldh = videoDisplay._height;
resizeIt(Stage.width, Stage.height);
fs = true;
this._visible = false;
};
fsBut.onMouseDown = function() {
if (fs == true) {
resizeIt(oldw, oldh);
fs = false;
this._visible = true;
}
};