stop();
import mx.transitions.Tween;
import mx.transitions.easing.*;
_root.nameIndex = Array();
_root.profileIndex = Array();
//determine which array to load
if (displayarray == null)
var displayarray = mixArray(Array (1,2,3,4,5,6));
else
displayarray = mixArray(displayarray).split(",");
var XMLnumber = displayarray[0];
displayarray.splice(0, 1);
var xmlpath = "sites/default/files/flashphotos/";
var XMLFile = new XML();
XMLFile.ignoreWhite = true;
//XMLFile.load(xmlpath + "photos" + XMLnumber + ".xml"); // Old method
XMLFile.load(xmlpath + "photos.xml"); // New method
XMLFile.onLoad = function()
{
_root.Width = XMLFile.firstChild.attributes.width;
_root.Height = XMLFile.firstChild.attributes.height;
_root.Speed = XMLFile.firstChild.attributes.speed;
_root.Images = XMLFile.firstChild.childNodes;
_root.Names = Array ();
_root.ImagesNo = Images.length;
_root.ImagePointer = 0;
createContainer();
callImages();
};
function createContainer()
{
_root.createEmptyMovieClip("Container", _root.getNextHighestDepth());
Container.lineStyle(0, 0x666666, 0);
Container.lineTo(_root.Width,0);
Container.lineTo(_root.Width,_root.Width);
Container.lineTo(0,_root.Height);
Container.lineTo(0,0);
Container._x = -155;
Container._y = 35;
}
function callImages()
{
_root.loader = new MovieClipLoader();
_root.preloader = new Object();
_root.loader.addListener(_root.preloader);
_root.imgArray = [];
_root.nameArray = [];
_root.preloader.onLoadStart = function(target)
{
new Tween(progress_container, "_alpha", Strong.easeOut, 0, 100, 1, true);
/*_root.createTextField("Name", _root.getNextHighestDepth(), 0, 0, 400, 30);
_root.Name._x = (Stage.width - _root.Name._width)/2;
_root.Name._y = 245;
_root.Name.autosize = "center";*/
};
_root.preloader.onLoadProgress = function(target)
{
// Nothing, duh
};
_root.preloader.onLoadComplete = function(target)
{
new Tween(progress_container, "_alpha", Strong.easeOut, 100, 0, 2, true);
//target = eval("_root.Container." + (target.attributes. + _root.ImagePointer));
trace(target);
_root.imgArray.push(target);
if (_root.ImagePointer < 7 && ((_root.ImagesNo < 6 && _root.imgArray.length == _root.ImagesNo) || _root.imgArray.length == 6))
{
_root.target_container = 0;
mover();
interval = setInterval(mover, (_root.Speed*1000)+1000);
}
_root.NameField.text = "";
_root.NameFieldButton.useHandCursor = false;
_root.nfbFixed = false;
};
_root.Images = mixArray(_root.Images);
LoadNewSet();
//looper = setInterval(LoadNewSet, 6000);
}
function LoadNewSet ()
{
for (i=0; i<_root.ImagesNo; i++)
{
o = i + _root.ImagePointer;
t_url = _root.Images[o].attributes.url; // For live site
//t_url = "http://www.#############.org" + _root.Images[o].attributes.url.substr(9); // For local testing
_root.Names[o] = _root.Images[o].attributes.title;
_root.nameIndex[filenameFromUrl(_root.Images[o].attributes.url)] = _root.Images[o].attributes.title;
_root.profileIndex[filenameFromUrl(_root.Images[o].attributes.url)] = _root.Images[o].attributes.profile;
t_container = Container.createEmptyMovieClip(o, -o);
_root.loader.loadClip(t_url, t_container);
if (o >= _root.ImagesNo)
{
clearInterval(looper);
}
}
}
function mover()
{
var nfb = _root.NameFieldButton;
var nf = _root.NameField;
i=i+2;;
j=i+1;
if (_root.target_container > 5)
{
f_container_bg = e_container_bg;
f_container_bg.swapDepths(-(j*13));
new Tween(f_container_bg, "_x", Regular.easeOut, f_container_bg._x, f_container_bg._x+100, _root.Speed, true);
f_container = _root.imgArray[_root.target_container-6];
f_container_bg.swapDepths(-(j*13)+1);
new Tween(f_container, "_x", Regular.easeOut, f_container._x, f_container._x+100, _root.Speed, true);
f_container.swapDepths(1048574); // THE FIX for broken removeMovieClip: removeMovieClip doesn't fucntion in a depth past 1048575
f_container_bg.swapDepths(1048575);
f_container.removeMovieClip();
f_container_bg.removeMovieClip();
}
if (_root.target_container > 4)
{
e_container_bg = d_container_bg;
e_container_bg.swapDepths(-(j*12));
new Tween(e_container_bg, "_x", Regular.easeOut, e_container_bg._x, e_container_bg._x+200, _root.Speed, true);
e_container = _root.imgArray[_root.target_container-5];
e_container.swapDepths(-(j*12)+1);
new Tween(e_container, "_x", Regular.easeOut, e_container._x, e_container._x+200, _root.Speed, true);
}
if (_root.target_container > 3)
{
d_container_bg = c_container_bg;
d_container_bg.swapDepths(-(j*11));
new Tween(c_container_bg, "_x", Regular.easeOut, d_container_bg._x, d_container_bg._x+147, _root.Speed, true);
new Tween(c_container_bg, "_y", Regular.easeOut, d_container_bg._y, d_container_bg._y-12, _root.Speed, true);
new Tween(c_container_bg, "_xscale", scaleFrom, 90, 80, _root.Speed, true);
new Tween(c_container_bg, "_yscale", scaleFrom, 90, 80, _root.Speed, true);
d_container = _root.imgArray[_root.target_container-4];
d_container.swapDepths(-(j*11)+1);
new Tween(d_container, "_x", Regular.easeOut, d_container._x, d_container._x+154, _root.Speed, true);
new Tween(d_container, "_y", Regular.easeOut, d_container._y, d_container._y-2, _root.Speed, true);
new Tween(d_container, "_xscale", scaleFrom, 90, 80, _root.Speed, true);
new Tween(d_container, "_yscale", scaleFrom, 90, 80, _root.Speed, true);
trace(-(j*10) + "vs" + -(j*11));
}
if (_root.target_container > 2)
{
c_container_bg = b_container_bg;
trace(c_container_bg.useHandCursor);
c_container_bg.swapDepths(-(j*10));
new Tween(c_container_bg, "_x", Regular.easeOut, c_container_bg._x, c_container_bg._x+146, _root.Speed, true);
new Tween(c_container_bg, "_y", Regular.easeOut, c_container_bg._y, c_container_bg._y-12, _root.Speed, true);
new Tween(c_container_bg, "_xscale", scaleFrom, 100, 90, _root.Speed, true);
new Tween(c_container_bg, "_yscale", scaleFrom, 100, 90, _root.Speed, true);
c_container = _root.imgArray[_root.target_container-3];
c_container.swapDepths(-(j*10)+1);
new Tween(c_container, "_x", Regular.easeOut, c_container._x, c_container._x+154, _root.Speed, true);
new Tween(c_container, "_y", Regular.easeOut, c_container._y, c_container._y-3, _root.Speed, true);
new Tween(c_container, "_xscale", scaleFrom, 100, 90, _root.Speed, true);
new Tween(c_container, "_yscale", scaleFrom, 100, 90, _root.Speed, true);
}
if (_root.target_container > 1)
{
b_container_bg = a_container_bg;
new Tween(b_container_bg, "_x", Regular.easeOut, b_container_bg._x, b_container_bg._x+174, _root.Speed, true);
new Tween(b_container_bg, "_y", Regular.easeOut, b_container_bg._y, b_container_bg._y+10, _root.Speed, true);
new Tween(b_container_bg, "_xscale", scaleFrom, 90, 100, _root.Speed, true);
new Tween(b_container_bg, "_yscale", scaleFrom, 90, 100, _root.Speed, true);
b_container = _root.imgArray[_root.target_container-2];
new Tween(b_container, "_x", Regular.easeOut, b_container._x, b_container._x+167, _root.Speed, true);
new Tween(b_container, "_y", Regular.easeOut, b_container._y, b_container._y+1, _root.Speed, true);
new Tween(b_container, "_xscale", scaleFrom, 90, 100, _root.Speed, true);
new Tween(b_container, "_yscale", scaleFrom, 90, 100, _root.Speed, true);
}
if (_root.target_container > 0)
{
a_container_bg = n_container_bg;
new Tween(a_container_bg, "_x", Regular.easeOut, a_container_bg._x, a_container_bg._x+114, _root.Speed, true);
new Tween(a_container_bg, "_y", Regular.easeOut, a_container_bg._y, a_container_bg._y+12, _root.Speed, true);
new Tween(a_container_bg, "_xscale", scaleFrom, 80, 90, _root.Speed, true);
new Tween(a_container_bg, "_yscale", scaleFrom, 80, 90, _root.Speed, true);
a_container = _root.imgArray[_root.target_container-1];
new Tween(a_container, "_x", Regular.easeOut, a_container._x, a_container._x+107, _root.Speed, true);
new Tween(a_container, "_y", Regular.easeOut, a_container._y, a_container._y+3, _root.Speed, true);
new Tween(a_container, "_xscale", scaleFrom, 80, 90, _root.Speed, true);
new Tween(a_container, "_yscale", scaleFrom, 80, 90, _root.Speed, true);
}
if (_root.target_container > (_root.ImagesNo + 1))
{
new Tween(c_container, "_alpha", Strong.easeOut, 100, 0, 1, true);
new Tween(c_container_bg, "_alpha", Strong.easeOut, 100, 0, 1, true);
new Tween(d_container, "_alpha", Strong.easeOut, 100, 0, 1, true);
new Tween(d_container_bg, "_alpha", Strong.easeOut, 100, 0, 1, true);
new Tween(e_container, "_alpha", Strong.easeOut, 100, 0, 1, true);
new Tween(e_container_bg, "_alpha", Strong.easeOut, 100, 0, 1, true);
new Tween(f_container, "_alpha", Strong.easeOut, 100, 0, 1, true);
new Tween(f_container_bg, "_alpha", Strong.easeOut, 100, 0, 1, true);
displayarray = displayarray.toString();
loadMovie("sites/default/themes/pstl/images/photo_banner.swf", _level0);
}
if (_root.Images[target_container-2] != Undefined && _root.Images[target_container-2] != undefined)
{
_root.NameField.text = nameFromClip(_root.imgArray[target_container-2]);
nfb.onPress = getPressCallback(profileFromClip(_root.imgArray[target_container-2]));
if (!(_root.nfbFixed))
{
nfb.useHandCursor = true;
_root.nfbFixed = true;
}
_root.NameField._width = _root.NameField.textWidth + 10;
_root.NameField._x = (Stage.width - _root.NameField._width)/2;
//nfb._width = _root.NameField._width;
//nfb._height = _root.NameField._height;
//nfb._width = 200;
//nfb._height = 200;
} else {
_root.NameField.text = "";
}
if (_root.Images[target_container] != Undefined && _root.Images[target_container] != undefined && nameFromClip(_root.imgArray[target_container]) != Undefined && nameFromClip(_root.imgArray[target_container]) != undefined)
{
nName = "container_bg_"+_root.target_container;
n_container_bg = _root.Container.attachMovie("backg", nName, -j, {_alpha:0});
new Tween(n_container_bg, "_alpha", Regular.easeOut, 0, 100, 1, true);
new Tween(n_container_bg, "_x", Regular.easeOut, n_container_bg._x+127, n_container_bg._x+227, _root.Speed, true);
new Tween(n_container_bg, "_y", Regular.easeOut, n_container_bg._y+88, n_container_bg._y+88, _root.Speed, true);
new Tween(n_container_bg, "_xscale", scaleFrom, 80, 80, _root.Speed, true);
new Tween(n_container_bg, "_yscale", scaleFrom, 80, 80, _root.Speed, true);
n_container_bg.onPress = getPressCallback(_root.Images[target_container].attributes.profile);
//n_container_bg.useHandCursor = true;
n_container_bg.onPress = getPressCallback(profileFromClip(_root.imgArray[target_container]));
}
else
{
n_container_bg = _root.attachMovie("blankg", nName, _root.target_container, {_x:-27, _y:123, _alpha:0});
}
n_container = _root.imgArray[_root.target_container];
n_container.swapDepths(-i);
new Tween(n_container, "_alpha", Regular.easeOut, 0, 100, 1, true);
new Tween(n_container, "_x", Regular.easeOut, n_container._x+67, n_container._x+167, _root.Speed, true);
new Tween(n_container, "_y", Regular.easeOut, n_container._y+13, n_container._y+13, _root.Speed, true);
new Tween(n_container, "_xscale", scaleFrom, 80, 80, _root.Speed, true);
new Tween(n_container, "_yscale", scaleFrom, 80, 80, _root.Speed, true);
_root.target_container++;
}
function getPressCallback(url) {
return function() {
//trace(url);
getURL('javascript:popUp("' + url + '");');
};
}
//put an array in a bag and shake it around
function mixArray (array:Array)
{
var _length:Number = array.length, mixed:Array = array.slice(), rn:Number, it:Number, el:Object;
for (it = 0; it<_length; it++) {
el = mixed[it];
mixed[it] = mixed[rn = random(_length)];
mixed[rn] = el;
}
return mixed;
}
function filenameFromUrl (url)
{
return url.substr(url.lastIndexOf("/"));
}
function nameFromClip (clip)
{
var url = clip._url;
var imgName = filenameFromUrl(url);
return _root.nameIndex[imgName];
}
function profileFromClip (clip)
{
var url = clip._url;
var imgName = filenameFromUrl(url);
return _root.profileIndex[imgName];
}