2 Replies Latest reply on Apr 24, 2011 3:52 PM by ezepsuarez1478

    Please... I need your help!!!!

    ezepsuarez1478

      Hello friends, I need your help.

       

      I have assembled the following code, I honestly do not know much about flash and developing the person who has disappeared and left alone.

       

      Need to know how to insert the volume control for this player and set a default value.

       

      I ask all who can lend a hand to solve this problem.

      Thanks to all!

       

      //Declaracion de variables
      var duracion:Number=10000000000000;

      var flv:String='../../../'+unescape(_root.flvFile);

      //trace(flv);
      //var flv='video.flv';
      //aviso.text=flv;

      //trace(flv);
      var conexion:NetConnection = new NetConnection();
      conexion.connect(null);
      var stream:NetStream = new NetStream(conexion);
      video.attachVideo(stream);
      stream.setBufferTime(10);
      stream.play(flv);
      //stream.pause();

      //Precarga para el archivo FLV
      this.onEnterFrame=function(){
      //obtengo el porcentaje
      var valor1:Number = Math.round(stream.bytesLoaded/stream.bytesTotal*100);
      estado.text=valor1;
      //basandome en el porcentaje modifico la barra
      barra_mc._xscale = valor1;
      //si completa el porcentaje mayor a 100
      //elimino el onEnterframe
      //porque ya cargo el FLV
      if (valor1>=100) {
          delete this.onEnterFrame;
      }
      }


      pause_mc._visible=false;
      var is_paused=false;
      var tamanio='chico';

      play_mc.onRelease = function(){
      if(!is_paused){
        stream.play(flv)
      }
      else{
        stream.pause();
        is_paused=false;
      }
      play_mc._visible=false;
      pause_mc._visible=true;
      botPlay_mc._visible=false;
      }
      botPlay_mc.onRelease = function(){
      if(!is_paused){
        stream.play(flv)
      }
      else{
        stream.pause();
        is_paused=false;
      }
      play_mc._visible=false;
      pause_mc._visible=true;
      botPlay_mc._visible=false;
      }

      play_mc.onRollOver=function(){
      var colorful = new Color("_root.play_mc");
          colorful.setRGB(0xFF6600);
      }
      play_mc.onRollOut=function(){
      var colorful = new Color("_root.play_mc");
          colorful.setRGB(0xFFFFFF);
      }
      pause_mc.onRelease=function(){

       

        play_mc._visible=true;
        pause_mc._visible=false;
        stream.pause();
        is_paused=true;

       

      }
      pause_mc.onRollOver=function(){
      var colorful = new Color("_root.pause_mc");
          colorful.setRGB(0xFF6600);
      }
      pause_mc.onRollOut=function(){
      var colorful = new Color("_root.pause_mc");
          colorful.setRGB(0xFFFFFF);
      }
      stop_mc.onRelease = function(){

       

      play_mc._visible=true;
      pause_mc._visible=false;
      stream.seek(0);
      stream.pause();
      }
      stop_mc.onRollOver=function(){
      var colorful = new Color("_root.stop_mc");
          colorful.setRGB(0xFF6600);
      }
      stop_mc.onRollOut=function(){
      var colorful = new Color("_root.stop_mc");
          colorful.setRGB(0xFFFFFF);
      }
      this.onEnterFrame = function() {
        var ns_seconds:Number = stream.time;
        var minutes:Number = Math.floor(ns_seconds/60);
        var seconds = Math.floor(ns_seconds%60);
        if (seconds<10) {
         seconds = "0"+seconds;
        }
        total.text = minutes+":"+seconds;
      };
      /////////////////////////////Metadatas//////////////////////////////// /
      stream.onMetaData = function(obj:Object){
      _root.duracion=obj.duration;
      //durac.text=duracion;
      var n_seconds:Number = _root.duracion;
      var str_minutes:Number = Math.floor(n_seconds/60);
      var str_seconds = Math.floor(n_seconds%60);
      if (str_seconds<10) {
        str_seconds = "0"+str_seconds;
      }
      durac.text= str_minutes+":"+str_seconds;
      }
      intervalo=setInterval(function():Void{
        var finalTime:Number=duracion;
        var finalWidth:Number = 163;
        var movVar:Number = finalWidth/finalTime;
        cabezal._width = movVar*stream.time;
        cabezal2._x=movVar*stream.time+39;
        if(Math.round(finalTime)<=Math.round(stream.time)){
         //trace("fin");
         play_mc._visible=true;
         pause_mc._visible=false;
         stream.seek(0);
         if(!_root.is_paused){
          _root.is_paused=true;
          stream.pause();
         }
        }
        //trace(movVar*stream.time);
      },10);
      /////////// Comprueba en el campo dinamico el estado del archivo flv////////////////////
      stream.onStatus = function(info){
      if (info.code == "NetStream.Buffer.Empty"){
        estado.text = "El buffer de datos está vacío";
      } else if (info.code == "NetStream.Buffer.Full"){
        estado.text = "El buffer de datos está lleno";
        estado.alphaTo(0,1,"linear",1);
      } else if (info.code == "NetStream.Play.Start"){
        estado.text = "Ha comenzado la reproducción del vídeo";
        //estado.tween("_alpha",0,1,"linear");
      } else if (info.code == "NetStream.Play.Stop"){
        estado.text = "Se ha detenido la reproducción del vídeo";
        estado.alphaTo(100,1,"linear",0);
        stop_mc.enabled = 0;
        stop_mc._alpha = 50;
        play_mc.enabled = pause_mc.enabled=1;
        play_mc._alpha = pause_mc._alpha=100;
        clearInterval(intervalo);
      } else if (info.code == "NetStream.Play.StreamNotFound"){
        estado.text = "No se encontró el vídeo solicitado:"+flvFile;
      }
      }


      bot_screen_grande_on._visible=false;
      bot_screen_chico_on._visible=false;
      bot_screen_grande.onRelease=function(){
      if(Stage["displayState"]=="normal"){
        Stage["displayState"]="fullScreen";
      }else{
        Stage["displayState"]="normal";
      }

       

      }
      bot_screen_grande.onRollOver=function(){
      var colorful = new Color("_root.bot_screen_grande");
          colorful.setRGB(0xAB10D0);
      }
      bot_screen_grande.onRollOut=function(){
      var colorful = new Color("_root.bot_screen_grande");
          colorful.setRGB(0xFFFFFF);
      }

      bot_screen_chico.onPress=function(){
      Stage["displayState"]="normal";
      //bot_screen_grande_on._visible=false;
      //bot_screen_grande._visible=true;
      if(tamanio=='chico'){
        fscommand("medium",'');
        tamanio='medium';
        var colorful = new Color("_root.bot_screen_chico");
           colorful.setRGB(0xFFFFFF);
       
      }
      else{
        fscommand("small",'');
        tamanio='chico';
        var colorful = new Color("_root.bot_screen_chico");
           colorful.setRGB(0xFFFFFF);
      }

       

      }
      bot_screen_chico.onRollOver=function(){
      var colorful = new Color("_root.bot_screen_chico");
          colorful.setRGB(0xFF6600);
      }
      bot_screen_chico.onRollOut=function(){
      var colorful = new Color("_root.bot_screen_chico");
          colorful.setRGB(0xFFFFFF);
      }