Hi, Its a lot to ask but any help would be appreciated…
Essentially I have an XML slideshow that builds a list of clickable thumbnails, and also sequentially load in the clips in the order set out in the XML file, (the swf’s also have a variable declared on the last frame after which the next SWF is allowed to load). This works fine, but here is whats the problem…
I also have bit of code on the thumbnails that holds A SWF url, and clicking on it forces the loading the SWF. Clearly this can mess up the above sequence, so the code just gets the nextSibling of the currently active node, and loads that…but it doesnt! and I cannot fix it…
import mx.transitions.Tween;
import mx.transitions.easing.*;
//my tween prototype //////////
MovieClip.prototype.easeInOut = function(endxscale, endyscale, endX, endY,startxrotation, endxrotation, secs, easeType) {
// var easeType = Regular.easeInOut;
trace("ease!!!")
var startX = this._x;
var startY = this._y;
var startXscale = this._xscale;
var startYscale = this._yscale;
if (this.xTween == undefined) {
this.xTween = new Tween(this, "_x", easeType, startX, endX, secs, true);
this.yTween = new Tween(this, "_y", easeType, startY, endY, secs, true);
this.xscaleTween = new Tween(this, "_xscale", easeType, startXscale, endXscale, secs, true);
this.yscaleTween = new Tween(this, "_yscale", easeType, startYscale, endYscale, secs, true);
this.xrotation = new Tween(this, "_rotation", easeType, startxrotation, endxrotation, secs, true);
} else {
this.xTween.continueTo(endX, secs);
this.yTween.continueTo(endY, secs);
this.xscaleTween.continueTo(endXscale, secs);
this.yscaleTween.continueTo(endYscale, secs);
this.xrotation.continueTo(endxrotation, secs);
}
};
//call the function!
/*
theBtn.onRelease=function(){
moveTheClip(movieClip1);
}
*/
Stage.scaleMode = "noScale";
Object._loc1 = this;
/*In MX, you could make the reference global so you won't have to use the
Object namespace at all:
movieName = this;
now movieName is _loc1.
*/
_loc1 = this;
////////////////////////////////////////////////////////////////////////////////////////////////////////
//// START SLIDESHOW
/////////////////////////////////////////////////////////////////////////////////////////////////////////
function startSlideShow(success)
{
if (success == true)
{
//start of new code
_loc1.numimages = this.firstChild.childNodes.length;
trace("NUMBER="+_loc1.numimages)
xspacing = 80;
yspacing = 65;
maxcols = 1;
thumbalpha = 99;
drop = 0;
pic = 0;
row = 1;
for (i = 0; i < _loc1.numimages; i++)
{
picHolder = this.firstChild.childNodes*;
// thumbHolder = slidebar.thumbnails.createEmptyMovieClip("thumbnail" + i, i);
thumbHolder = slidebar.thumbnails.attachMovie("thumbox","thumbnail" + i, i)
thumbholder._alpha = thumbalpha;
thumbHolder._xscale = 80
thumbHolder._yscale = 80
thumbHolder.thumboxcontent.thumb_txt.text = picHolder.attributes.titletxt
if (pic >= maxcols)
{
drop = yspacing * row;
row = row + 1;
pic = 0;
thumbHolder._x = pic * xspacing;
} // end if
thumbHolder._x = pic * xspacing;
thumbHolder._y = drop;
pic = pic + 1;
;
thumbLoader = thumbHolder.thumboxcontent.thumbnail_image;
//scale large image down...image is made bigger to keep quality on scale up!
thumbLoader._xscale=83;
thumbLoader._yscale=83;
//LOAD THUMBNAILS//////////
thumbLoader.loadMovie(picHolder.attributes.thmb);
thumbHolder.title = picHolder.attributes.title;
thumbHolder.main = picHolder.attributes.main;
//CLICK TO LOAD FUNCTION//////////
thumbHolder.onRelease = function ()
{
//FORCE NEW SLIDE//////
forcenew = true;
forcenewslide = this.main;
trace("fns "+forcenewslide)
loader(forcenewslide)
};
//END CLICK TO LOAD FUNCTION//////////
thumbHolder.onRollOver = function ()
{
this.swapDepths(99999)
this.gotoAndPlay(2);
};
thumbHolder.onRollOut = function ()
{
this.gotoAndPlay(1);
//moveTheClip(this, 200,100);
//title_txt.text = ""
this.fade(thumbalpha);
};
} // end of for
rootNode = slides_xml.firstChild;
totalSlides = rootNode.childNodes.length;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
currentIndex = 1;
updateSlide(firstSlideNode);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
//// FUNCTION LOADANDSWAP()
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// [Action in Frame 1]
function LOADANDSWAP()
{
if(forcenew == true){
imagePath = forcenewslide
forcenew = false;
}
//USNING NO preload code
loadMovie(imagePath, targetx.holder);
if (_loc1.endx == true){
trace("run")
targety = eval(endmovie);
trace ("end--------------" + endmovie);
endmovie.onEnterFrame = function ()
{
if (targetx.holder._width)
{
endmovie.movie.gotoAndPlay("in");
delete this.onEnterFrame;
} // end if
};
}
else
{
trace("run")
targety = eval ("_loc1.maintop.topclip" + (i - 1));
targety.onEnterFrame = function ()
{
if (targetx.holder._width)
{
targety.movie.gotoAndPlay("in");
delete this.onEnterFrame;
} // end if
};
} // end else if
} // End of the function
function LOADANDSWAPend()
{
trace ("end!!!!!!!!!!!!!");
targetz = eval(_loc1.endx);
targetz.movie.gotoAndPlay("in");
} // End of the function
////////////////////////////////////////////////////////////////////////////////////////////////////////
//// FUNCTION UPDATESLIDE
/////////////////////////////////////////////////////////////////////////////////////////////////////////
function updateSlide(nextSlideNode)
{
var _loc1 = this;
if (forcenew == true){
imagePath = forcenewslide.main;
slideText = forcenewslide.firstChild.nodeValue;
}else{
imagePath = nextSlideNode.attributes.main;
slideText = nextSlideNode.firstChild.nodeValue;
}
p = i - i - i;
targetx = maintop.attachMovie("topclip", "topclip" + i, p);
LOADANDSWAP(imagePath);
++i;
} // End of the function
////////////////////////////////////////////////////////////////////////////////////////////////////////
//// FUNCTION LOADER
/////////////////////////////////////////////////////////////////////////////////////////////////////////
loader = function ()
{
var _loc1 = _level0;
if (targetx.holder.lastframe == true || forcenew == true )
{
nextSlideNode = currentSlideNode.nextSibling;
trace("next " + currentSlideNode.nextSibling.attributes.main)
if (nextSlideNode == null)
{
_loc1.endx = true;
_loc1.targetx.swapDepths(1);
_loc1.endmovie = _loc1.targetx;
i = 1;
nextSlideNode = rootNode.firstChild;
currentSlideNode = nextSlideNode;
updateSlide(nextSlideNode);
return;
} // end if
_loc1.endx = false;
++currentIndex;
updateSlide(nextSlideNode);
currentSlideNode = nextSlideNode;
} // end if
};
////////////////////////////////////////////////////////////////////////////////////////////////////////
//// CALL LOADER
/////////////////////////////////////////////////////////////////////////////////////////////////////////
i = 1;
slides_xml = new XML();
slides_xml.onLoad = startSlideShow;
slides_xml.load("http://localhost/onlinetoolkit/home/slides.xml");
slides_xml.ignoreWhite = true;
setInterval(loader, 100);
//