1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
|
name_arr = new Array();
date_arr = new Array();
explain_arr = new Array();
maGalerie = new XML();
maGalerie.ignoreWhite = true;
maGalerie.load("galerie.xml");
maGalerie.onLoad = function ()
{
_global.numOfCon = maGalerie.firstChild.childNodes.length;
for (var _loc3 = 0; _loc3 < numOfCon; ++_loc3)
{
node = this.firstChild.childNodes;
name_arr[_loc3] = node[_loc3].childNodes[0].firstChild.nodeValue;
date_arr[_loc3] = node[_loc3].childNodes[1].firstChild.nodeValue;
explain_arr[_loc3] = node[_loc3].childNodes[2].firstChild.nodeValue;
description.name_txt = name_arr[0];
description.date_txt = date_arr[0];
description.explain_txt = explain_arr[0];
} // end of for
};
function init()
{
numOfBox = 30;//Total number of images show on movie
thumb_holder._alpha = 0;
outThumb._visible = false;
moveX = -14;
image_width = 45;//thumb box width
image_spaceX = 5;//space between thumb images
speed = 4.000000E-001;
speed_thumb = 3.000000E-001;
smooth.swapDepths(1900);
right_btn.swapDepths(2000);
left_btn.swapDepths(2001);
_root.createEmptyMovieClip("group", 1000);
group.setMask(thumb_holder);
nextCount = 1;
prevCount = 1;
_global.imageNumber = 1;
} // End of the function
function moveBox()
{
for (var _loc3 = 1; _loc3 < numOfBox; ++_loc3)
{
group.attachMovie("outThumb", "outThumb" + _loc3, _loc3 + 100);
thMc = group["outThumb" + _loc3];
thMc._x = moveX + _loc3 * (image_width + image_spaceX);
thMc._y = thumb_holder._y + 8;
thMc.onRelease = function ()
{
description.name_txt = name_arr[Number(this._name.substr(8, 9)) - 1];
description.date_txt = date_arr[Number(this._name.substr(8, 9)) - 1];
description.explain_txt = explain_arr[Number(this._name.substr(8, 9)) - 1];
_global.imageNumber = Number(this._name.substr(8, 9));
loadBigImage();
};
} // end of for
loadThumbs();
} // End of the function
function setupBtn()
{
left_btn.onRelease = function ()
{
prevCount = prevCount + 1;
targetX = 50 - 50 * prevCount;
if (prevCount < numOfBox - 15)
{
nextCount = prevCount;
group.onEnterFrame = function ()
{
this._x = this._x + speed_thumb * (targetX - this._x);
};
}
else
{
delete group.onEnterFrame;
} // end else if
};
right_btn.onRelease = function ()
{
nextCount = nextCount - 1;
targetX = 50 - 50 * nextCount;
if (nextCount >= 1)
{
prevCount = nextCount;
group.onEnterFrame = function ()
{
this._x = this._x + speed_thumb * (targetX - this._x);
};
}
else
{
delete group.onEnterFrame;
} // end else if
};
} // End of the function
function loadThumbs()
{
var _loc2 = new MovieClipLoader();
var _loc3 = new Object();
_loc3.onLoadProgress = function (target, bytesLoaded, bytesTotal)
{
};
_loc3.onLoadError = function (target_mc, errorCode, httpStatus)
{
target_mc._parent.noData.dataTxt = "VIDE";
};
_loc3.onLoadInit = function (target)
{
target._parent.noData._visible = false;
target._parent.SPbar._visible = false;
loadBigImage();
};
_loc2.addListener(_loc3);
for (var _loc1 = 1; _loc1 < numOfBox; ++_loc1)
{
containerMC = group["outThumb" + _loc1];
_loc2.loadClip("small/image" + _loc1 + ".jpg", containerMC.inThumb);
} // end of for
} // End of the function
function loadBigImage()
{
var _loc2 = new MovieClipLoader();
var _loc1 = new Object();
_loc1.onLoadProgress = function (target, bytesLoaded, bytesTotal)
{
loadedBytes = bytesLoaded;
totalBytes = bytesTotal;
photo.percent_mc.percent = Math.floor(loadedBytes / totalBytes * 100) + "%";
group["outThumb" + imageNumber].SPbar._visible = true;
group["outThumb" + imageNumber].SPbar._alpha = 50;
group["outThumb" + imageNumber].SPbar._yscale = Math.floor(loadedBytes / totalBytes * 100);
};
_loc1.onLoadError = function (target_mc, errorCode, httpStatus)
{
photo.percent_mc.percent = "VIDE";//displayed text when no data image
description.name_txt = "";//displayed text when no data text 1
description.date_txt = "";//displayed text when no data text 2
description.explain_txt = "";//displayed text when no data text 3
};
_loc1.onLoadInit = function (target)
{
imageEffect();
};
_loc2.addListener(_loc1);
_loc2.loadClip("large/image" + imageNumber + ".jpg", photo.inScr);
} // End of the function
function imageEffect()
{
photo.inScr._xscale = 10;
photo.inScr._yscale = 10;
photo.inScr._x = 150;
photo.inScr._y = 150;
bigImage = photo.inScr;
this.onEnterFrame = function ()
{
bigImage._x = bigImage._x + speed * -bigImage._x;
bigImage._y = bigImage._y + speed * -bigImage._y;
bigImage._xscale = bigImage._xscale + speed * (100 - bigImage._xscale);
bigImage._yscale = bigImage._yscale + speed * (100 - bigImage._yscale);
if (bigImage._x <= 0)
{
this.onEnterFrame = null;
} // end if
};
} // End of the function
stop ();
init();
moveBox();
setupBtn(); |
Partager