5 Replies Latest reply on May 6, 2010 9:13 AM by kglad

    Need help with xml video gallery

    lamar7williams Level 1

      Hello everyone

       

      I recently bought a xml video gallery. I'm loading the movie externally into another movie. When the xml gallery loads, it cancels all sounds.

       

      I need to figure out where in the actionscription can i reverse the cancellation of sounds. Can anyone help? if possible, I can email, whomever is willing to help, the xml gallery to see if theres another reason the sound is being canceled.

       

      Also, the sound of the gallery doesn't work til you click the volume scroller.

       

      Here are two parts of actionscript included in the gallery:

       

      part one:

       

      // Import filter classes
      import mx.transitions.Tween;
      import mx.transitions.easing.*;
      // Set flash variables
      var xmlFileUrl:String = "playlist.xml";
      var auto_play:String = "true";
      // Set xml file URL
      if (_root.xmlfile) {
          xmlFileUrl = _root.xmlfile;
      };
      var V_SRC;
      var thuArray:Array = new Array();
      var currentVideo:Number = 0;
      var totalItems;
      var numOfItems:Number;
      var itemDistance:Number = 120+5;
      var itemHeight:Number = 80+2;
      var Value:Number = 1;
      var boundry:Number = 1;
      var ratio:Number = 1;
      var diff:Number = 1;
      var collectionWidth:Number = 1;
      var buffer:Number = 135*2;
      this.createEmptyMovieClip("video_txt",this.getNextHighestDepth());
      video_txt.createTextField("theText",video_txt.getNextHighestDepth(),0,0,584,36);
      video_txt.theText.selectable = false;
      video_txt.theText.autoSize = "left";
      //The Format
      myFormat = new TextFormat();
      myFormat.font = _root.font_format;
      myFormat.size = _root.font_size;
      myFormat.color = _root.font_color;
      myFormat.align = "center";
      video_txt.theText.setNewTextFormat(myFormat);
      // Create a new movieclip to load the thumbs
      var thumbLoader:MovieClipLoader = new MovieClipLoader();
      var thumbListener:Object = new Object();
      thumbLoader.addListener(thumbListener);
      thumbListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number)
      {
          new Tween(target_mc, "_alpha", Regular.easeOut, 0, 100, 1, true);
          target_mc._parent.preloader_mc._alpha = 0;
      };
      var xml:XML = new XML();
      xml.ignoreWhite = true;
      xml.onLoad = xmlLoaded;
      xml.load(xmlFileUrl);
      // Load the xml file into the player
      function xmlLoaded(b:Boolean) {

       

          if (b) {
              auto_play = this.firstChild.firstChild.attributes.auto_play;
              scrollSpeed = parseInt(this.firstChild.firstChild.attributes.scrollSpeed);
              totalItems = this.firstChild.firstChild.childNodes;
              numOfItems = totalItems.length;

       

              for (j=0; j<numOfItems; j++) {
                  var i = player_mc.main_mc.collection_mc.attachMovie("mc_Thumb", "thumb_"+j, j);

       

                  i._x = itemDistance*j;

       

                  thumbLoader.loadClip(totalItems[j].attributes.thumb,i.loader_mc);

       

                  i.id = j;
                  i.videoTitle = totalItems[j].attributes.title;
                  i.videoUrl = totalItems[j].attributes.src;
                  // Create an event for thumb rollover
                  i.onRollOver = iRoll;
                  i.onRollOut = i.onReleaseOutside=iOut;
                  i.onRelease = iRelease;

       

                  thuArray[j] = i;
              }
              // default first video
              collectionWidth = player_mc.main_mc.collection_mc._width;
              currentVideo = 0;
              V_SRC = thuArray[0].videoUrl;
              changeVideo();
              //scope._alpha = 100;
              new Tween(scope, "_alpha", Regular.easeOut, 0, 100, 0.5, true);
          }
          else
          {
              trace("Error! xml file not loaded");
          }
      };
      // onRollOver Events
      function iRoll() {
          player_mc.mc_title.title_txt.htmlText = totalItems[this.id].attributes.title;
          this.light_mc.play();
      };
      function iRelease() {
          currentVideo = this.id;
          changeVideo();
      };
      function changeVideo() {
          V_SRC = thuArray[currentVideo].videoUrl;
          player_mc.loadVideo();
          currentThumb();
          player_mc.mc_title.title_txt.htmlText = thuArray[currentVideo].videoTitle;
          video_txt.theText.text = totalItems[currentVideo].attributes.title;
          player_mc.so.getVolume();
          player_mc.playStatus = 1;
          player_mc.checkStatus();
      };
      function nextVideo() {
          if (currentVideo<(numOfItems-1)) {
              currentVideo++;
          } else {
              currentVideo = 0;
          }
          changeVideo();
      };
      function currentThumb() {
          for (i=0; i<thuArray.length; i++) {
              if (i == currentVideo) {
                  thuArray[i].enabled = true;
              }
          }
      };
      // Mouse movement on rollover
      this.onMouseMove = function() {
          collectionWidth = player_mc.main_mc.collection_mc._width;
          boundry = player_mc.main_mc.area_mc._width;
          if ((player_mc.main_mc._ymouse>0) && (player_mc.main_mc._ymouse<itemHeight)) {
              if ((player_mc.main_mc._xmouse>0) && (player_mc.main_mc._xmouse<boundry)) {
                  ratio = player_mc.main_mc._xmouse/boundry;
                  diff = (collectionWidth-boundry)+buffer;
                  Value = Math.floor((-ratio)*diff)+(buffer/2);
                  // *******
              }
          }
          updateAfterEvent();
      };
      this.onEnterFrame = function() {
          // Define movement area and speed
          if (player_mc.main_mc.collection_mc._width>player_mc.main_mc.area_mc._width) {
              player_mc.main_mc.collection_mc._x = Math.round((player_mc.main_mc.collection_mc._x)+((Value-player_mc.main_mc.collection_mc._ x)/scrollSpeed));
              // *******
              if (player_mc.main_mc.collection_mc._x>0) {
                  player_mc.main_mc.collection_mc._x = 0;
              } else if (player_mc.main_mc.collection_mc._x<(player_mc.main_mc.area_mc._width-(player_mc.main_mc. collection_mc._width))) {
                  player_mc.main_mc.collection_mc._x = Math.round(player_mc.main_mc.area_mc._width-(player_mc.main_mc.collection_mc._width));
              }
          } else {
              player_mc.main_mc.collection_mc._x = 0;
          }
          updateAfterEvent();
      };

       

       

       

      part two:

       

       

      // Define flash variables
      var video_url:String = "";
      var tempx:Number = this._parent._x;
      var tempy:Number = this._parent._y;
      var timeCounter:Number = 0;
      var timeInSeconds:Number = _root.time_counter;
      // Object to listen to onStage Event
      videoObj = vid.videoObj;
      // Setting up the connection
      var nc:NetConnection = new NetConnection();
      nc.connect(null);
      var ns:NetStream = new NetStream(nc);
      // Buffer time
      ns.setBufferTime (10);
      videoObj.attachVideo (ns);
      function loadVideo () {
          video_url = _parent.V_SRC;
          trace(video_url);
          ns.play (video_url);
      };
      function checkStatus()
      {
          if (playStatus == 1)
          {
              controls_mc.playPause.gotoAndStop("pause");
              mc_playAgain._visible = false;
              thumbs_out = false;
              title_out = false;
          }
          else
          {
              controls_mc.playPause.gotoAndStop("play");
              mc_playAgain._visible = true;
          } // end else if
          if (so.getVolume() == 0)
          {
              controls_mc.mute_mc.gotoAndStop("mute");
          }
          else
          {
              controls_mc.mute_mc.gotoAndStop("on");
          }
      }; // End of the function
      mc_playAgain._visible = false;
      // Check Status of video
      ns.onStatus = function (info)
      {
          if (info.code == "NetStream.Buffer.Empty")
          {
              mc_buffer._visible = true;
          }
          else if (info.code == "NetStream.Buffer.Full")
          {
              mc_buffer._visible = false;
          }
          else if (info.code == "NetStream.Play.Stop")
          {
              ns.seek(0);
              if (playStatus == 1)
              {
                  ns.pause();
                  playStatus = 0;
              }
              else
              {
                  trace;
              } // end else if
              mc_playAgain._visible = true;
              mc_buffer._visible = false;
              thumbs_out = true;
              title_out = true;
              checkStatus();
          } // end else if
      };
      // Get info about video
      ns.onMetaData = function(infoObject:Object)
      {
          FLVduration = infoObject["duration"];
          relationshipW = infoObject.height / infoObject.width;
          relationshipH = infoObject.width / infoObject.height;
          if (Stage["displayState"] == "fullScreen")
          {
              largeSize ();
          }
          else
          {
              regularSize ();
          }
          if (_parent.auto_play == "false")
          {
              ns.seek(0);
              if (playStatus == 1)
              {
                  ns.pause();
                  playStatus = 0;
              }
              mc_buffer._visible = false;
              controls_mc.playPause.gotoAndStop("play");
              mc_playAgain._visible = true;
              thumbs_out = true;
              title_out = true;
              _parent.auto_play = "true";
          }// end else if
      };
      var videoInterval = setInterval(videoStatus, 100);
      var amountLoaded;
      var duration;
      // videoStatus on load Event
      function videoStatus()
      {
          amountLoaded = ns.bytesLoaded / ns.bytesTotal;
          controls_mc.mc_progress.mc_buff._width = amountLoaded * 250;
          controls_mc.mc_progress.mc_played._x = ns.time / duration * 250;
          controls_mc.mc_progress.mc_played._xscale = Math.round(ns.time*100/FLVduration);
      }; // End of the function
      function scrubIt()
      {
          ns.seek(Math.floor(controls_mc.mc_progress.mc_played._x / 250 * duration));
      }; // End of the function
      // video time
      var time_interval:Number = setInterval(checkTime, 500, ns);
      function checkTime(ns:NetStream) {
          //current time
          var ns_seconds:Number = ns.time;
          var minutes:Number = Math.floor(ns_seconds/60);
          var seconds = Math.floor(ns_seconds%60);
          sec = seconds;
          min = minutes;
          if (sec<10) {
              sec = "0"+sec;
          }
          if (min<10) {
              min = "0"+min;
          }
          controls_mc.time_txt.time_1.text = min+":"+sec;
          //total time
          var minutes2:Number = Math.floor(FLVduration/60);
          var seconds2 = Math.floor(FLVduration%60);
          sec2 = seconds2;
          min2 = minutes2;
          if (sec2<10) {
              sec2 = "0"+sec2;
          }
          if (min2<10) {
              min2 = "0"+min2;
          }
          controls_mc.time_txt.time_2.text = min2+":"+sec2;
          if (controls_mc.time_txt.time_2.text == "NaN:NaN") {
              controls_mc.time_txt.time_2.text = "00:00";
          }
      };
      setStage ();
      // Object to listen onStage Event
      var stageL:Object = new Object ();
      // function respnsible for content alignment
      function setStage ()
      {
          if (Stage["displayState"] == "fullScreen") {


              tempx = this._parent._x;
              tempy = this._parent._y;
              this._parent._x = 0;
              this._parent._y = 0;
             
              vidBg_mc._x = 0;
              vidBg_mc._y = 0;
              mc_title._x = 0;
              mc_title._y = -30;
              slide_me._x = 0;
              slide_me._y = 0;
              vidBg_mc._width = Stage.width;
              vidBg_mc._height = Stage.height;
              mc_title._width = Stage.width;
              mc_title._height = Stage.height / 20;
              slide_me._width = Stage.width;
              slide_me._height = Stage.height / 20;
             
              vid._x = vid._y = 0;
              largeSize ();


              controls_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));
              controls_mc._y = Math.round (Stage.height - 36);
              mc_playAgain._x = Math.round ((Stage.width / 2) - (mc_playAgain._width / 2));
              mc_playAgain._y = Math.round (Stage.height - 572);
              thumbs_mc._x = Math.round ((Stage.width / 2) - (thumbs_mc._width / 2));
              thumbs_mc._y = Math.round (Stage.height - 115);
              main_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));;


              hide_mc.onEnterFrame = function () {
                  timeCounter = timeCounter + 1;
                  if (timeCounter >= timeInSeconds * 30) {
                      timeCounter = 0;
                      controls_mc._alpha = 0;
                  }
              };
             
              this.onMouseMove = function () {
                  timeCounter = 0;
                  controls_mc._alpha = 100;
              };
          }
          else
          {       
              delete hide_mc.onEnterFrame;
              delete this.onMouseMove;
             
              controls_mc._alpha = 100;


              this._parent._x = tempx;
              this._parent._y = tempy;
             
              vidBg_mc._width = 600;
              vidBg_mc._height = 360;
              mc_title._width = 600;
              mc_title._height = 30;
              slide_me._width = 600;
              slide_me._height = 30;
              vidBg_mc._x = vid._x = 0;
              vidBg_mc._y = vid._y = 35;
              mc_title._x = vid._x = 0;
              mc_title._y = vid._x = -30;
              slide_me._x = vid._x = 0;
              slide_me._y = vid._y = 35;


              regularSize ();


              controls_mc._x = 0;
              controls_mc._y = 395;
              mc_playAgain._x = 243;
              mc_playAgain._y = 158;
              thumbs_mc._x = 0;
              thumbs_mc._y = 316;
              main_mc._x = 0;
              main_mc._y = 406;
          }
          mc_buffer._x = Math.round (vidBg_mc._x + (vidBg_mc._width / 2));
          mc_buffer._y = Math.round (vidBg_mc._y + (vidBg_mc._height / 2));
      };
      // to apply when stage (browser window) is resized or modified
      stageL.onResize = function () {
          setStage ();
      };
      // attaching object to the stage
      Stage.addListener (stageL);
      MovieClip.prototype.slide = function(yPos) {
          this._y -= (this._y-yPos)/5;
      };
      // tilte actions
      mc_title.onEnterFrame = function()
      {
          if (Stage["displayState"] == "normal" && title_out == false)
          {
              this.slide(5);
          }
          else if (Stage["displayState"] == "normal" && title_out == true)
          {
              this.slide(35);
          }
          if (Stage["displayState"] == "fullScreen" && title_out == false)
          {
              this._y -= (this._y+106)/5;
          }
          else if (Stage["displayState"] == "fullScreen" && title_out == true)
          {
              this.slide(0);
          }
      };
      // thumbs actions
      main_mc.onEnterFrame = function()
      {
          if (Stage["displayState"] == "normal" && thumbs_out == false)
          {
              this.slide(406);
          }
          else if (Stage["displayState"] == "normal" && thumbs_out == true)
          {
              this.slide(299);
          }
          if (Stage["displayState"] == "fullScreen" && thumbs_out == false)
          {
              this._y = Math.round (Stage.height - 0);
          }
          else if (Stage["displayState"] == "fullScreen" && thumbs_out == true)
          {
              this._y = Math.round (Stage.height - 133);
          }
      };
      // Playlist button
      controls_mc.playlist_mc.onRollOver = function ()
      {
          this.gotoAndStop("playlistOver");
      };
      controls_mc.playlist_mc.onRollOut = controls_mc.playlist_mc.onReleaseOutside = function ()
      {
          this.gotoAndStop("playlist");
      };
      // Toggle playlist button
      controls_mc.playlist_mc.onRelease = function ()
      {
          if (thumbs_out == false)
          {
              thumbs_out = true;
              title_out = true;
          }
          else if (thumbs_out == true)
          {
              thumbs_out = false;
              title_out = false;
          } // end if else
      };
      // Define hit area for playPause button
      vid.onPress = controls_mc.playPause.onRelease = function ()
      {
          ns.pause();
          if (playStatus == 1)
          {
              controls_mc.playPause.gotoAndStop("play")
              playStatus = 0;
              checkStatus();
          }
          else if (playStatus == 0)
          {
              controls_mc.playPause.gotoAndStop("pause");
              playStatus = 1;
              checkStatus();
          }
      };
      // playPause button
      controls_mc.playPause.onRollOver = function ()
      {
          if (playStatus == 1)
          {
              this.gotoAndStop("pauseOver");
          }
          else
          {
              this.gotoAndStop("playOver");
          } // end else if
      };
      controls_mc.playPause.onRollOut = controls_mc.playPause.onReleaseOutside = function ()
      {
          if (playStatus == 1)
          {
              this.gotoAndStop("pause");
          }
          else
          {
              this.gotoAndStop("play");
          } // end else if
      };
      // Toggle playPause button
      controls_mc.playPause.onRelease = function ()
      {
          ns.pause();
          if (playStatus == 1)
          {
              this.gotoAndStop("play");
              playStatus = 0;
              checkStatus();
          }
          else if (playStatus == 0)
          {
              this.gotoAndStop("pause");
              playStatus = 1;
              checkStatus();
          }
      };
      controls_mc.skip_mc.onRollOver = function ()
      {
          this.gotoAndStop("skipOver");
      };
      controls_mc.skip_mc.onRollOut = controls_mc.skip_mc.onReleaseOutside = function ()
      {
          this.gotoAndStop("skip");
      };
      controls_mc.skip_mc.onRelease = function ()
      {
          _parent.nextVideo()
      };
      // Play Again button
      mc_playAgain.onRollOver = function ()
      {
          this.gotoAndStop("playAgainOver");
      };
      mc_playAgain.onRollOut = mc_playAgain.onReleaseOutside = function ()
      {
          this.gotoAndStop("playAgain");
      };
      // Toggle Play Again button
      mc_playAgain.onRelease = function ()
      {
          this._visible = false;
          ns.pause();
          playStatus = 1;
          checkStatus();
      };
      // make the seek bar clickable
      controls_mc.mc_progress.mc_buff.onPress = function()
      {
          xpos = controls_mc.mc_progress._xmouse;
          percent = Math.round(xpos/controls_mc.mc_progress._width*100);
          seekTime = percent/100*FLVduration;
          seekTime = Math.round(seekTime*100)/100;
          ns.seek(seekTime);
      };
      // Set volume level
      var s:Sound = new Sound();
      s.setVolume(_root.volume_value);
      controls_mc.mc_soundLevel.mc_volume._xscale = _root.volume_value;
      // Volume control
      controls_mc.mc_soundLevel.onPress = function()
      {
          volumeTo = (this._xmouse / this._width)*100;
          this.mc_volume._xscale = volumeTo;
          s.setVolume(volumeTo);
      };
      // Volume
      _parent.createEmptyMovieClip("vSound", _parent.getNextHighestDepth());
      vSound.attachAudio(ns);
      var so = new Sound(vSound);
      so.setVolume(_root.volume_value);
      // Mute button
      controls_mc.mute_mc.onRollOver = function ()
      {
          if (so.getVolume() >= 1)
          {
              this.gotoAndStop("onOver");
          }
          else
          {
              this.gotoAndStop("muteOver");
          } // end else if
      };
      controls_mc.mute_mc.onRollOut = controls_mc.mute_mc.onReleaseOutside = function ()
      {
          if (so.getVolume() >= 1)
          {
              this.gotoAndStop("on");
          }
          else
          {
              this.gotoAndStop("mute");
          } // end else if
      };
      // Toggle mute button
      controls_mc.mute_mc.onRelease = function ()
      {
          if (so.getVolume() >= 1)
          {
              controls_mc.mc_soundLevel.mc_volume._xscale = 0;
              so.setVolume(0);
              this.gotoAndStop("muteOver");
          }
          else
          {
              controls_mc.mc_soundLevel.mc_volume._xscale = 70;
              so.setVolume(_root.volume_value);
              this.gotoAndStop("onOver");
          } // end else if
      };
      // Resize video proportionaly
      function regularSize ()
      {
          videoObj._width = 600;
          videoObj._height = videoObj._width * relationshipW;
          if (videoObj._height > 360)
          {
              videoObj._height = 360;
              videoObj._width = videoObj._height * relationshipH;
          }
          videoObj.smoothing = true;
          //var scale:Number;
          videoObj._x = (600 - videoObj._width) / 2;
          videoObj._y = (360 - videoObj._height) / 2;
      };
      function largeSize ()
      {
          videoObj._width = Stage.width;
          videoObj._height = videoObj._width * relationshipW;
          if (videoObj._height > Stage.height)
          {
              videoObj._height = Stage.height;
              videoObj._width = videoObj._height * relationshipH;
          }
          videoObj.smoothing = true;
          //var scale:Number;
          videoObj._x = (Stage.width - videoObj._width) / 2;
          videoObj._y = (Stage.height - videoObj._height) / 2;
      };
      // Fullscreen button
      controls_mc.fullscreen_mc.onRollOver = function ()
      {
          if (Stage["displayState"] == "normal")
          {
              this.gotoAndStop("fullOver");
          }
          else
          {
              this.gotoAndStop("fullCloseOver");
          } // end else if
      };
      controls_mc.fullscreen_mc.onRollOut = controls_mc.fullscreen_mc.onReleaseOutside = function ()
      {
          if (Stage["displayState"] == "normal")
          {
              this.gotoAndStop("full");
          }
          else
          {
              this.gotoAndStop("fullClose");
          } // end else if
      };
      // Toggle fullscreen button
      controls_mc.fullscreen_mc.onRelease = function ()
      {
          if (Stage["displayState"] == "normal")
          {
              Stage["displayState"] = "fullscreen";
              _parent.video_txt.theText._visible = false;
          }
          else
          {
              Stage["displayState"] = "normal";
              _parent.video_txt.theText._visible = true;
          }
      };

        • 1. Re: Need help with xml video gallery
          kglad Adobe Community Professional & MVP

          if you mean sound works well when the gallery is tested without being loaded into another swf but fails when loaded, change the highlighted line:

           

           

           

          // Import filter classes
          import mx.transitions.Tween;
          import mx.transitions.easing.*;
          // Set flash variables
          var xmlFileUrl:String = "playlist.xml";
          var auto_play:String = "true";
          // Set xml file URL
          if (_root.xmlfile) {
              xmlFileUrl = _root.xmlfile;
          };
          var V_SRC;
          var thuArray:Array = new Array();
          var currentVideo:Number = 0;
          var totalItems;
          var numOfItems:Number;
          var itemDistance:Number = 120+5;
          var itemHeight:Number = 80+2;
          var Value:Number = 1;
          var boundry:Number = 1;
          var ratio:Number = 1;
          var diff:Number = 1;
          var collectionWidth:Number = 1;
          var buffer:Number = 135*2;
          this.createEmptyMovieClip("video_txt",this.getNextHighestDepth());
          video_txt.createTextField("theText",video_txt.getNextHighestDepth(),0,0,584,36);
          video_txt.theText.selectable = false;
          video_txt.theText.autoSize = "left";
          //The Format
          myFormat = new TextFormat();
          myFormat.font = _root.font_format;
          myFormat.size = _root.font_size;
          myFormat.color = _root.font_color;
          myFormat.align = "center";
          video_txt.theText.setNewTextFormat(myFormat);
          // Create a new movieclip to load the thumbs
          var thumbLoader:MovieClipLoader = new MovieClipLoader();
          var thumbListener:Object = new Object();
          thumbLoader.addListener(thumbListener);
          thumbListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number)
          {
              new Tween(target_mc, "_alpha", Regular.easeOut, 0, 100, 1, true);
              target_mc._parent.preloader_mc._alpha = 0;
          };
          var xml:XML = new XML();
          xml.ignoreWhite = true;
          xml.onLoad = xmlLoaded;
          xml.load(xmlFileUrl);
          // Load the xml file into the player
          function xmlLoaded(b:Boolean) {

           

              if (b) {
                  auto_play = this.firstChild.firstChild.attributes.auto_play;
                  scrollSpeed = parseInt(this.firstChild.firstChild.attributes.scrollSpeed);
                  totalItems = this.firstChild.firstChild.childNodes;
                  numOfItems = totalItems.length;

           

                  for (j=0; j<numOfItems; j++) {
                      var i = player_mc.main_mc.collection_mc.attachMovie("mc_Thumb", "thumb_"+j, j);

           

                      i._x = itemDistance*j;

           

                      thumbLoader.loadClip(totalItems[j].attributes.thumb,i.loader_mc);

           

                      i.id = j;
                      i.videoTitle = totalItems[j].attributes.title;
                      i.videoUrl = totalItems[j].attributes.src;
                      // Create an event for thumb rollover
                      i.onRollOver = iRoll;
                      i.onRollOut = i.onReleaseOutside=iOut;
                      i.onRelease = iRelease;

           

                      thuArray[j] = i;
                  }
                  // default first video
                  collectionWidth = player_mc.main_mc.collection_mc._width;
                  currentVideo = 0;
                  V_SRC = thuArray[0].videoUrl;
                  changeVideo();
                  //scope._alpha = 100;
                  new Tween(scope, "_alpha", Regular.easeOut, 0, 100, 0.5, true);
              }
              else
              {
                  trace("Error! xml file not loaded");
              }
          };
          // onRollOver Events
          function iRoll() {
              player_mc.mc_title.title_txt.htmlText = totalItems[this.id].attributes.title;
              this.light_mc.play();
          };
          function iRelease() {
              currentVideo = this.id;
              changeVideo();
          };
          function changeVideo() {
              V_SRC = thuArray[currentVideo].videoUrl;
              player_mc.loadVideo();
              currentThumb();
              player_mc.mc_title.title_txt.htmlText = thuArray[currentVideo].videoTitle;
              video_txt.theText.text = totalItems[currentVideo].attributes.title;
              player_mc.so.getVolume();
              player_mc.playStatus = 1;
              player_mc.checkStatus();
          };
          function nextVideo() {
              if (currentVideo<(numOfItems-1)) {
                  currentVideo++;
              } else {
                  currentVideo = 0;
              }
              changeVideo();
          };
          function currentThumb() {
              for (i=0; i<thuArray.length; i++) {
                  if (i == currentVideo) {
                      thuArray[i].enabled = true;
                  }
              }
          };
          // Mouse movement on rollover
          this.onMouseMove = function() {
              collectionWidth = player_mc.main_mc.collection_mc._width;
              boundry = player_mc.main_mc.area_mc._width;
              if ((player_mc.main_mc._ymouse>0) && (player_mc.main_mc._ymouse<itemHeight)) {
                  if ((player_mc.main_mc._xmouse>0) && (player_mc.main_mc._xmouse<boundry)) {
                      ratio = player_mc.main_mc._xmouse/boundry;
                      diff = (collectionWidth-boundry)+buffer;
                      Value = Math.floor((-ratio)*diff)+(buffer/2);
                      // *******
                  }
              }
              updateAfterEvent();
          };
          this.onEnterFrame = function() {
              // Define movement area and speed
              if (player_mc.main_mc.collection_mc._width>player_mc.main_mc.area_mc._width) {
                  player_mc.main_mc.collection_mc._x = Math.round((player_mc.main_mc.collection_mc._x)+((Value-player_mc.main_mc.colle ction_mc._x)/scrollSpeed));
                  // *******
                  if (player_mc.main_mc.collection_mc._x>0) {
                      player_mc.main_mc.collection_mc._x = 0;
                  } else if (player_mc.main_mc.collection_mc._x<(player_mc.main_mc.area_mc._width-(player_m c.main_mc.collection_mc._width))) {
                      player_mc.main_mc.collection_mc._x = Math.round(player_mc.main_mc.area_mc._width-(player_mc.main_mc.collection_mc._w idth));
                  }
              } else {
                  player_mc.main_mc.collection_mc._x = 0;
              }
              updateAfterEvent();
          };

           

           

           

          part two:

           

           

          // Define flash variables
          var video_url:String = "";
          var tempx:Number = this._parent._x;
          var tempy:Number = this._parent._y;
          var timeCounter:Number = 0;
          var timeInSeconds:Number = _root.time_counter;
          // Object to listen to onStage Event
          videoObj = vid.videoObj;
          // Setting up the connection
          var nc:NetConnection = new NetConnection();
          nc.connect(null);
          var ns:NetStream = new NetStream(nc);
          // Buffer time
          ns.setBufferTime (10);
          videoObj.attachVideo (ns);
          function loadVideo () {
              video_url = _parent.V_SRC;
              trace(video_url);
              ns.play (video_url);
          };
          function checkStatus()
          {
              if (playStatus == 1)
              {
                  controls_mc.playPause.gotoAndStop("pause");
                  mc_playAgain._visible = false;
                  thumbs_out = false;
                  title_out = false;
              }
              else
              {
                  controls_mc.playPause.gotoAndStop("play");
                  mc_playAgain._visible = true;
              } // end else if
              if (so.getVolume() == 0)
              {
                  controls_mc.mute_mc.gotoAndStop("mute");
              }
              else
              {
                  controls_mc.mute_mc.gotoAndStop("on");
              }
          }; // End of the function
          mc_playAgain._visible = false;
          // Check Status of video
          ns.onStatus = function (info)
          {
              if (info.code == "NetStream.Buffer.Empty")
              {
                  mc_buffer._visible = true;
              }
              else if (info.code == "NetStream.Buffer.Full")
              {
                  mc_buffer._visible = false;
              }
              else if (info.code == "NetStream.Play.Stop")
              {
                  ns.seek(0);
                  if (playStatus == 1)
                  {
                      ns.pause();
                      playStatus = 0;
                  }
                  else
                  {
                      trace;
                  } // end else if
                  mc_playAgain._visible = true;
                  mc_buffer._visible = false;
                  thumbs_out = true;
                  title_out = true;
                  checkStatus();
              } // end else if
          };
          // Get info about video
          ns.onMetaData = function(infoObject:Object)
          {
              FLVduration = infoObject["duration"];
              relationshipW = infoObject.height / infoObject.width;
              relationshipH = infoObject.width / infoObject.height;
              if (Stage["displayState"] == "fullScreen")
              {
                  largeSize ();
              }
              else
              {
                  regularSize ();
              }
              if (_parent.auto_play == "false")
              {
                  ns.seek(0);
                  if (playStatus == 1)
                  {
                      ns.pause();
                      playStatus = 0;
                  }
                  mc_buffer._visible = false;
                  controls_mc.playPause.gotoAndStop("play");
                  mc_playAgain._visible = true;
                  thumbs_out = true;
                  title_out = true;
                  _parent.auto_play = "true";
              }// end else if
          };
          var videoInterval = setInterval(videoStatus, 100);
          var amountLoaded;
          var duration;
          // videoStatus on load Event
          function videoStatus()
          {
              amountLoaded = ns.bytesLoaded / ns.bytesTotal;
              controls_mc.mc_progress.mc_buff._width = amountLoaded * 250;
              controls_mc.mc_progress.mc_played._x = ns.time / duration * 250;
              controls_mc.mc_progress.mc_played._xscale = Math.round(ns.time*100/FLVduration);
          }; // End of the function
          function scrubIt()
          {
              ns.seek(Math.floor(controls_mc.mc_progress.mc_played._x / 250 * duration));
          }; // End of the function
          // video time
          var time_interval:Number = setInterval(checkTime, 500, ns);
          function checkTime(ns:NetStream) {
              //current time
              var ns_seconds:Number = ns.time;
              var minutes:Number = Math.floor(ns_seconds/60);
              var seconds = Math.floor(ns_seconds%60);
              sec = seconds;
              min = minutes;
              if (sec<10) {
                  sec = "0"+sec;
              }
              if (min<10) {
                  min = "0"+min;
              }
              controls_mc.time_txt.time_1.text = min+":"+sec;
              //total time
              var minutes2:Number = Math.floor(FLVduration/60);
              var seconds2 = Math.floor(FLVduration%60);
              sec2 = seconds2;
              min2 = minutes2;
              if (sec2<10) {
                  sec2 = "0"+sec2;
              }
              if (min2<10) {
                  min2 = "0"+min2;
              }
              controls_mc.time_txt.time_2.text = min2+":"+sec2;
              if (controls_mc.time_txt.time_2.text == "NaN:NaN") {
                  controls_mc.time_txt.time_2.text = "00:00";
              }
          };
          setStage ();
          // Object to listen onStage Event
          var stageL:Object = new Object ();
          // function respnsible for content alignment
          function setStage ()
          {
              if (Stage["displayState"] == "fullScreen") {


                  tempx = this._parent._x;
                  tempy = this._parent._y;
                  this._parent._x = 0;
                  this._parent._y = 0;
                 
                  vidBg_mc._x = 0;
                  vidBg_mc._y = 0;
                  mc_title._x = 0;
                  mc_title._y = -30;
                  slide_me._x = 0;
                  slide_me._y = 0;
                  vidBg_mc._width = Stage.width;
                  vidBg_mc._height = Stage.height;
                  mc_title._width = Stage.width;
                  mc_title._height = Stage.height / 20;
                  slide_me._width = Stage.width;
                  slide_me._height = Stage.height / 20;
                 
                  vid._x = vid._y = 0;
                  largeSize ();


                  controls_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));
                  controls_mc._y = Math.round (Stage.height - 36);
                  mc_playAgain._x = Math.round ((Stage.width / 2) - (mc_playAgain._width / 2));
                  mc_playAgain._y = Math.round (Stage.height - 572);
                  thumbs_mc._x = Math.round ((Stage.width / 2) - (thumbs_mc._width / 2));
                  thumbs_mc._y = Math.round (Stage.height - 115);
                  main_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));;


                  hide_mc.onEnterFrame = function () {
                      timeCounter = timeCounter + 1;
                      if (timeCounter >= timeInSeconds * 30) {
                          timeCounter = 0;
                          controls_mc._alpha = 0;
                      }
                  };
                 
                  this.onMouseMove = function () {
                      timeCounter = 0;
                      controls_mc._alpha = 100;
                  };
              }
              else
              {       
                  delete hide_mc.onEnterFrame;
                  delete this.onMouseMove;
                 
                  controls_mc._alpha = 100;


                  this._parent._x = tempx;
                  this._parent._y = tempy;
                 
                  vidBg_mc._width = 600;
                  vidBg_mc._height = 360;
                  mc_title._width = 600;
                  mc_title._height = 30;
                  slide_me._width = 600;
                  slide_me._height = 30;
                  vidBg_mc._x = vid._x = 0;
                  vidBg_mc._y = vid._y = 35;
                  mc_title._x = vid._x = 0;
                  mc_title._y = vid._x = -30;
                  slide_me._x = vid._x = 0;
                  slide_me._y = vid._y = 35;


                  regularSize ();


                  controls_mc._x = 0;
                  controls_mc._y = 395;
                  mc_playAgain._x = 243;
                  mc_playAgain._y = 158;
                  thumbs_mc._x = 0;
                  thumbs_mc._y = 316;
                  main_mc._x = 0;
                  main_mc._y = 406;
              }
              mc_buffer._x = Math.round (vidBg_mc._x + (vidBg_mc._width / 2));
              mc_buffer._y = Math.round (vidBg_mc._y + (vidBg_mc._height / 2));
          };
          // to apply when stage (browser window) is resized or modified
          stageL.onResize = function () {
              setStage ();
          };
          // attaching object to the stage
          Stage.addListener (stageL);
          MovieClip.prototype.slide = function(yPos) {
              this._y -= (this._y-yPos)/5;
          };
          // tilte actions
          mc_title.onEnterFrame = function()
          {
              if (Stage["displayState"] == "normal" && title_out == false)
              {
                  this.slide(5);
              }
              else if (Stage["displayState"] == "normal" && title_out == true)
              {
                  this.slide(35);
              }
              if (Stage["displayState"] == "fullScreen" && title_out == false)
              {
                  this._y -= (this._y+106)/5;
              }
              else if (Stage["displayState"] == "fullScreen" && title_out == true)
              {
                  this.slide(0);
              }
          };
          // thumbs actions
          main_mc.onEnterFrame = function()
          {
              if (Stage["displayState"] == "normal" && thumbs_out == false)
              {
                  this.slide(406);
              }
              else if (Stage["displayState"] == "normal" && thumbs_out == true)
              {
                  this.slide(299);
              }
              if (Stage["displayState"] == "fullScreen" && thumbs_out == false)
              {
                  this._y = Math.round (Stage.height - 0);
              }
              else if (Stage["displayState"] == "fullScreen" && thumbs_out == true)
              {
                  this._y = Math.round (Stage.height - 133);
              }
          };
          // Playlist button
          controls_mc.playlist_mc.onRollOver = function ()
          {
              this.gotoAndStop("playlistOver");
          };
          controls_mc.playlist_mc.onRollOut = controls_mc.playlist_mc.onReleaseOutside = function ()
          {
              this.gotoAndStop("playlist");
          };
          // Toggle playlist button
          controls_mc.playlist_mc.onRelease = function ()
          {
              if (thumbs_out == false)
              {
                  thumbs_out = true;
                  title_out = true;
              }
              else if (thumbs_out == true)
              {
                  thumbs_out = false;
                  title_out = false;
              } // end if else
          };
          // Define hit area for playPause button
          vid.onPress = controls_mc.playPause.onRelease = function ()
          {
              ns.pause();
              if (playStatus == 1)
              {
                  controls_mc.playPause.gotoAndStop("play")
                  playStatus = 0;
                  checkStatus();
              }
              else if (playStatus == 0)
              {
                  controls_mc.playPause.gotoAndStop("pause");
                  playStatus = 1;
                  checkStatus();
              }
          };
          // playPause button
          controls_mc.playPause.onRollOver = function ()
          {
              if (playStatus == 1)
              {
                  this.gotoAndStop("pauseOver");
              }
              else
              {
                  this.gotoAndStop("playOver");
              } // end else if
          };
          controls_mc.playPause.onRollOut = controls_mc.playPause.onReleaseOutside = function ()
          {
              if (playStatus == 1)
              {
                  this.gotoAndStop("pause");
              }
              else
              {
                  this.gotoAndStop("play");
              } // end else if
          };
          // Toggle playPause button
          controls_mc.playPause.onRelease = function ()
          {
              ns.pause();
              if (playStatus == 1)
              {
                  this.gotoAndStop("play");
                  playStatus = 0;
                  checkStatus();
              }
              else if (playStatus == 0)
              {
                  this.gotoAndStop("pause");
                  playStatus = 1;
                  checkStatus();
              }
          };
          controls_mc.skip_mc.onRollOver = function ()
          {
              this.gotoAndStop("skipOver");
          };
          controls_mc.skip_mc.onRollOut = controls_mc.skip_mc.onReleaseOutside = function ()
          {
              this.gotoAndStop("skip");
          };
          controls_mc.skip_mc.onRelease = function ()
          {
              _parent.nextVideo()
          };
          // Play Again button
          mc_playAgain.onRollOver = function ()
          {
              this.gotoAndStop("playAgainOver");
          };
          mc_playAgain.onRollOut = mc_playAgain.onReleaseOutside = function ()
          {
              this.gotoAndStop("playAgain");
          };
          // Toggle Play Again button
          mc_playAgain.onRelease = function ()
          {
              this._visible = false;
              ns.pause();
              playStatus = 1;
              checkStatus();
          };
          // make the seek bar clickable
          controls_mc.mc_progress.mc_buff.onPress = function()
          {
              xpos = controls_mc.mc_progress._xmouse;
              percent = Math.round(xpos/controls_mc.mc_progress._width*100);
              seekTime = percent/100*FLVduration;
              seekTime = Math.round(seekTime*100)/100;
              ns.seek(seekTime);
          };
          // Set volume level
          var s:Sound = new Sound(this);
          s.setVolume(_root.volume_value);
          controls_mc.mc_soundLevel.mc_volume._xscale = _root.volume_value;
          // Volume control
          controls_mc.mc_soundLevel.onPress = function()
          {
              volumeTo = (this._xmouse / this._width)*100;
              this.mc_volume._xscale = volumeTo;
              s.setVolume(volumeTo);
          };
          // Volume
          _parent.createEmptyMovieClip("vSound", _parent.getNextHighestDepth());
          vSound.attachAudio(ns);
          var so = new Sound(vSound);
          so.setVolume(_root.volume_value);
          // Mute button
          controls_mc.mute_mc.onRollOver = function ()
          {
              if (so.getVolume() >= 1)
              {
                  this.gotoAndStop("onOver");
              }
              else
              {
                  this.gotoAndStop("muteOver");
              } // end else if
          };
          controls_mc.mute_mc.onRollOut = controls_mc.mute_mc.onReleaseOutside = function ()
          {
              if (so.getVolume() >= 1)
              {
                  this.gotoAndStop("on");
              }
              else
              {
                  this.gotoAndStop("mute");
              } // end else if
          };
          // Toggle mute button
          controls_mc.mute_mc.onRelease = function ()
          {
              if (so.getVolume() >= 1)
              {
                  controls_mc.mc_soundLevel.mc_volume._xscale = 0;
                  so.setVolume(0);
                  this.gotoAndStop("muteOver");
              }
              else
              {
                  controls_mc.mc_soundLevel.mc_volume._xscale = 70;
                  so.setVolume(_root.volume_value);
                  this.gotoAndStop("onOver");
              } // end else if
          };
          // Resize video proportionaly
          function regularSize ()
          {
              videoObj._width = 600;
              videoObj._height = videoObj._width * relationshipW;
              if (videoObj._height > 360)
              {
                  videoObj._height = 360;
                  videoObj._width = videoObj._height * relationshipH;
              }
              videoObj.smoothing = true;
              //var scale:Number;
              videoObj._x = (600 - videoObj._width) / 2;
              videoObj._y = (360 - videoObj._height) / 2;
          };
          function largeSize ()
          {
              videoObj._width = Stage.width;
              videoObj._height = videoObj._width * relationshipW;
              if (videoObj._height > Stage.height)
              {
                  videoObj._height = Stage.height;
                  videoObj._width = videoObj._height * relationshipH;
              }
              videoObj.smoothing = true;
              //var scale:Number;
              videoObj._x = (Stage.width - videoObj._width) / 2;
              videoObj._y = (Stage.height - videoObj._height) / 2;
          };
          // Fullscreen button
          controls_mc.fullscreen_mc.onRollOver = function ()
          {
              if (Stage["displayState"] == "normal")
              {
                  this.gotoAndStop("fullOver");
              }
              else
              {
                  this.gotoAndStop("fullCloseOver");
              } // end else if
          };
          controls_mc.fullscreen_mc.onRollOut = controls_mc.fullscreen_mc.onReleaseOutside = function ()
          {
              if (Stage["displayState"] == "normal")
              {
                  this.gotoAndStop("full");
              }
              else
              {
                  this.gotoAndStop("fullClose");
              } // end else if
          };
          // Toggle fullscreen button
          controls_mc.fullscreen_mc.onRelease = function ()
          {
              if (Stage["displayState"] == "normal")
              {
                  Stage["displayState"] = "fullscreen";
                  _parent.video_txt.theText._visible = false;
              }
              else
              {
                  Stage["displayState"] = "normal";
                  _parent.video_txt.theText._visible = true;
              }
          };

          • 2. Re: Need help with xml video gallery
            lamar7williams Level 1

            kglad

             

            Thank you so much for response. Even when tested not in another movie the

            sound isnt there til you hit the volume scroller.

             

            I'm not so sure what to change the highlighted text to to make a difference.

            Can i send you the xml file?

             

             

            --

            Lamar Williams

            lamar7williams@gmail.com

            williamsgraphix@gmail.com

            www.williamsgraphix.com

            914.391.7039

            • 3. Re: Need help with xml video gallery
              kglad Adobe Community Professional & MVP

              i don't download and correct files unless i'm hired.

               

              check the lines of code just below where i highlighted.  that looked like it was setting the volume.

              • 4. Re: Need help with xml video gallery
                lamar7williams Level 1

                How much do you charge? By the hour or a flate fee?

                • 5. Re: Need help with xml video gallery
                  kglad Adobe Community Professional & MVP

                  send me an email via my website:  www.kglad.com