0 Replies Latest reply on Jan 21, 2007 1:50 PM by tony_b_48

    Actionscript Local Shared Object Works Fine then Fails After 4 Minutes

    tony_b_48
      This failure only occurs with one of my testers using Firefox. It does not fail on my computer using Firefox. It does not fail on anyone's computer using IE6 or IE7. I have 2 separate flash files, one with a thumbnail array and one is a fullsize image. The client insisted on 2 separate files. You may view a trimmed-down version at http://www.tonybarre.com/Flash/index.html. When you rollover a thumbnail, I write a unique code to a LSO. The fullsize file continually polls the LSO. When it finds a change, it updates the fullsize image. It initially works in my tester's Firefox browser, but after 4 minutes the rollovers no longer cause a fullsize image update. Below you will find the actionscript from the thumbnail file, followed by the actionscript from the fullsize file.
      ***Thumbnail***
      var tcode = "asa_";

      _global.allClips = new Array();
      for (i=0;i<24;i++){
      var mcName = "imageHolder" + i + "_mc";
      this.holder1_mc.createEmptyMovieClip(mcName,i);
      allClips.push(mcName);
      }
      _global.glowClips = new Array();
      for (var i=0; i<24;i++) {
      var glowName = "glowHolder" + i + "_mc";
      this.holder2_mc.createEmptyMovieClip(glowName,i);
      glowClips.push(glowName);
      }
      var num = 0;
      for (var j=1;j<=3;j++) {
      for (var k=1;k<=2;k++) {
      for (var i=1;i<=(6 - 2 * (j-1));i++) {
      num++;
      if (num>99) {
      thumbNum = num;
      }else if (num>9) {
      thumbNum = "0" + num;
      }else {
      thumbNum = "00" + num;
      }
      var thumbName = "thumbs" + "/" + tcode + thumbNum + ".jpg";
      thisMovie=this.holder1_mc[allClips[num-1]];
      loadMovie(thumbName,thisMovie);
      thisMovie._x= (i-1) * 52 ;
      thisMovie._y= 18 + ((k-1)+(2*(j-1))) * 52 ;

      thisGlow=this.holder2_mc[glowClips[num-1]];
      thisGlow.attachMovie("MC_glow", "glow"+i+"_mc", i);
      thisGlow._x = (i-1) * (52) - 3;
      thisGlow._y = 15 + ((k-1)+(2*(j-1))) * 52;
      thisGlow._alpha = 0;
      }
      }
      }
      _global.linksArray = new Array();
      varsObj = new LoadVars();
      varsObj.onLoad = function() {
      for (i=0;i<24;i++) {
      linksArray =varsObj["url" + (i+1)];
      }
      for (var m=0;m<24;m++) {
      thisLink=linksArray[m];
      if (thisLink !== "") {
      thisMovie=_root.holder1_mc[allClips[m]];
      thisMovie.index=m;
      thisMovie.onRelease = function () {
      getURL(linksArray[this.index]);
      }
      thisMovie.onRollOver = function () {
      thisGlow=_root.holder2_mc[glowClips[this.index]];
      thisGlow._alpha = 85;
      var imageToShow_so = SharedObject.getLocal("imageToShare", "/");
      imageToShow_so.data.imageNumber = this.index;
      imageToShow_so.flush();
      }
      thisMovie.onRollOut = function () {
      thisGlow=_root.holder2_mc[glowClips[this.index]];
      thisGlow._alpha = 0;
      }
      }
      }
      }
      varsObj.load("links.txt");

      ***FullSize***

      var tcode = "asa_";

      descr_txt.text = "Mouse Over a ThumbNail Image to View Full Size Image";

      _global.oldNum = (-1);
      _global.toggle = 2;

      _root.holder_mc.createEmptyMovieClip("imageHolder1",1);
      _root.holder_mc.imageHolder1.createEmptyMovieClip("image",1);
      _root.holder_mc.imageHolder1.image._x=0;
      _root.holder_mc.imageHolder1.image._y=30;
      _root.holder_mc.createEmptyMovieClip("imageHolder2",2);
      _root.holder_mc.imageHolder2.createEmptyMovieClip("image",1)

      function updateImage () {
      var newImage_so = SharedObject.getLocal("imageToShare", "/");
      var imageNum = newImage_so.data.imageNumber + 1;
      if (imageNum !== oldNum) {
      if (imageNum == 0) {
      }else{
      if (imageNum>99) {
      image = imageNum;
      }else if (imageNum>9) {
      image = "0" + imageNum;
      }else {
      image = "00" + imageNum;
      }
      var newImage = "fullsize" + "/" + tcode + image + ".jpg";
      if (toggle == 1) {
      if (textArray[imageNum-1]==undefined){
      descr_txt.text = "Mouse Over a ThumbNail Image to View Full Size";
      }else{
      descr_txt.text = textArray[imageNum-1];
      }
      _root.holder_mc.imageHolder1.image.loadMovie(newImage,1);
      _root.holder_mc.imageHolder1.image._x=0;
      _root.holder_mc.imageHolder1.image._y=30;
      _root.holder_mc.imageHolder1.onEnterFrame = function () {
      if (this._alpha < 100) {
      this._alpha += 10;
      }else {
      delete this.onEnterFrame;
      }
      }
      _root.holder_mc.imageHolder2.onEnterFrame = function () {
      if (this._alpha > 0) {
      this._alpha -= 15;
      }else {
      delete this.onEnterFrame;
      }
      }
      toggle = 2;
      } else if (toggle == 2) {
      if (textArray[imageNum-1]==undefined){
      descr_txt.text = "Mouse Over a ThumbNail Image to View Full Size";
      }else{
      descr_txt.text = textArray[imageNum-1];
      }
      _root.holder_mc.imageHolder2.image.loadMovie(newImage,1);
      _root.holder_mc.imageHolder2.image._x=0;
      _root.holder_mc.imageHolder2.image._y=30;
      _root.holder_mc.imageHolder2.onEnterFrame = function () {
      if (this._alpha < 100) {
      this._alpha += 10;
      }else {
      delete this.onEnterFrame;
      }
      }
      _root.holder_mc.imageHolder1.onEnterFrame = function () {
      if (this._alpha > 0) {
      this._alpha -= 15;
      }else {
      delete this.onEnterFrame;
      }
      }
      toggle = 1;
      }
      }
      oldNum = imageNum;
      }
      }
      setInterval(updateImage,300);