Se la montagna non va da Maometto...
Ho parzialmente risolto il problema (non è tutta farina del mio sacco), con il seguente codice che metto a disposizione di chi abbia incontrato le mie stesse difficoltà:
codice:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.setBufferTime(5);
ns.onStatus = function(info) {
if(info.code == "NetStream.Buffer.Full"){
bufferClip._visible=false;
}
if(info.code == "NetStream.Buffer.Empty"){
bufferClip._visible=true;
}
if(info.code == "NetStream.Play.Stop"){
ns.seek(0);
ns.pause();
}
}
mio_video.attachVideo(ns);
ns.play("mio.flv");
playButton.onRelease = function(){
ns.pause();
}
var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;
var duration:Number;
ns["onMetaData"] = function (obj) {
duration = obj.duration;
}
function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
//680 = length of loader bar
loader.loadbar._width = amountLoaded * 680;
loader.scrub._x = ns.time / duration * 680;
}
var scrubInterval;
loader.scrub.onPress = function(){
clearInterval(videoInterval);
scrubInterval = setInterval(scrubit,100);
this.startDrag(false,0,this._y,680,this._y);
}
loader.scrub.onRelease = loader.scrub.onReleaseOutside = function (){
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus,100);
this.stopDrag();
}
function scrubit(){
ns.seek(Math.floor((loader.scrub._x/680)*duration));
}
_root.createEmptyMovieClip("vSound",_root.getNextHighestDepth());
vSound.attachAudio(ns);
var so:Sound = new Sound (vSound);
so.setVolume(100);
mute.onRollOver = function() {
if (so.getVolume()==100) {
this.gotoAndStop("onOver");
}else{
this.gotoAndStop("offOver");
}
}
mute.onRollOut = function() {
if (so.getVolume()==100) {
this.gotoAndStop("on");
}else{
this.gotoAndStop("off");
}
}
mute.onRelease = function() {
if (so.getVolume()==100) {
so.setVolume(0);
this.gotoAndStop("off");
}else{
so.setVolume(100);
this.gotoAndStop("on");
}
}
Oltre al controllo play-pausa, comprende anche quello per l'audio e una barra di scorrimento. Funziona benissimo, ma l'unico neo è che non fa il rollover tra i tasti pausa e play. (a me non interessa molto, in quanto posso sostituire l'icona di tutti e due i tasti con un'unica immagine che comprende pausa e play).
Detto questo, rimane un problema molto grande: l'swf è inserito in una pagina html che prevede la visualizzazione a schermo intero:
codice:
margin:0px;
padding:0px;
height:100%;
overflow:hidden;
ma la posizione dei controlli varia a seconda della risoluzione dello schermo!
Qualcuno potrebbe/saprebbe cortesemente aiutarmi?
Grazie a prescindere.
P.s.: la questione del loop, rimane sempre aperta...