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
// here is the code which precedes the number in the thumb file name
// it must be specified as a parameter in the tag that calls this movie
var tcode = “asa_”;
// Create an array to hold the names of all the movie clips
_global.allClips = new Array();
// Make a batch of empty movie clips; put their names in the array
for (i=0;i<24;i++){
var mcName = “imageHolder” + i + “_mc”;
this.holder1_mc.createEmptyMovieClip(mcName,i);
allClips.push(mcName);
}
// Create an array to hold the names of all the glow clips
_global.glowClips = new Array();
// Create the names; put them in the array. create the clips; attach the glow later
for (var i=0; i<24;i++) {
var glowName = “glowHolder” + i + “_mc”;
this.holder2_mc.createEmptyMovieClip(glowName,i);
glowClips.push(glowName);
}
// fill & position the movie clips
// i is the “column”; j is the first, 2nd, or 3rd grouping of 2 rows;
// k is the row within the grouping; num keeps track of the 24 movie clips in sequence
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++) {
// construct a string for the sequence number to match thumb names
num++;
if (num>99) {
thumbNum = num;
}else if (num>9) {
thumbNum = “0” + num;
}else {
thumbNum = “00” + num;
}
// construct the name of the thumbnail, including the path
var thumbName = “thumbs” + “/” + tcode + thumbNum + “.jpg”;
// here is convenient way to refer to the movie clip on this iteration
thisMovie=this.holder1_mc[allClips[num-1]];
// put the thumbnail into the movie clip
loadMovie(thumbName,thisMovie);
// move the movie clip into place
thisMovie._x= (i-1) * 52 ;
thisMovie._y= 18 + ((k-1)+(2*(j-1))) * 52 ;
// here is a convenient way to refer to the glow clip on this iteration
thisGlow=this.holder2_mc[glowClips[num-1]];
// attach the glow to the glowClip
thisGlow.attachMovie("MC_glow", "glow"+i+"_mc", i);
// move the glow into place; set alpha to zero. glow effect will come from alpha
thisGlow._x = (i-1) * (52) - 3;
thisGlow._y = 15 + ((k-1)+(2*(j-1))) * 52;
thisGlow._alpha = 0;
}
}
}
// When you click on a thumbnail, you go to a new page.
// links.txt contains a table of links. The next block loads that table
// and assigns them to the appropriate thumbnails.
// Here is an array in which to put the links
_global.linksArray = new Array();
// First we load the links into a LoadVars object and thence into the array
varsObj = new LoadVars();
varsObj.onLoad = function() {
for (i=0;i<24;i++) {
linksArray*=varsObj[“url” + (i+1)];
}
// assign links to movie clips
for (var m=0;m<24;m++) {
thisLink=linksArray[m];
// the external file has a placeholder for all the links
// if the placeholder is blank, there is no corresponding thumbnail and there is a
// blank rectangle instead. If we roll over this blank rectangle we want no state change
if (thisLink !== “”) {
// here is a convenient reference to the movie clip to which we will assign behaviours
thisMovie=_root.holder1_mc[allClips[m]];
// we assign a property to this movie in order to carry it into the function below
thisMovie.index=m;
thisMovie.onRelease = function () {
getURL(linksArray[this.index]);
}
thisMovie.onRollOver = function () {
// glow (note: because of the if statement: no link, no glow)
// as above, a convenient reference to the current glow clip
// note that without assigning the index property above, we would not have
// access to m inside the function
thisGlow=_root.holder2_mc[glowClips[this.index]];
thisGlow._alpha = 85;
// write the image number to a Local Shared Object.
// Tells which full-size image to show in a different flash file
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
// here is the code which precedes the number in the thumb file name
// it must be specified as a parameter in the tag that calls this movie
// and the statement below can be removed.
var tcode = “asa_”;
descr_txt.text = “Mouse Over a ThumbNail Image to View Full Size Image”;
_global.oldNum = (-1);
_global.toggle = 2;
// let’s load images alternately into imageHolder1 and imageHolder2
// we put an extra level of container. loading a jpg into the “image” container destroys
// all the properties of “image”. so instead we put all the properties onto imageHolder 1 & 2
_root.holder_mc.createEmptyMovieClip(“imageHolder1”,1);
_root.holder_mc.imageHolder1.createEmptyMovieClip(“image”,1);
//_root.holder_mc.imageHolder1.image.attachMovie(“MC_Default”, “default_mc”,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”, “/”);
// a convenient way to refer to the image number
var imageNum = newImage_so.data.imageNumber + 1;
if (imageNum !== oldNum) {
if (imageNum == 0) {
//load default background; not implemented. client happy with background
}else{
// build the name of the image
if (imageNum>99) {
image = imageNum;
}else if (imageNum>9) {
image = “0” + imageNum;
}else {
image = “00” + imageNum;
}
// construct the name of the thumbnail, including the path
var newImage = “fullsize” + “/” + tcode + image + “.jpg”;
// alternately load images into imageHolder1 and imageHolder2
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);