hi. my first post so
problem:
i got this transition:
http://www.marcusscheller.com/tst/template.html (you need to wait a bit + reload)
the pictures are coming via xml (same folder).
q:
how do i increase the length (time) in between the transitions?
and
why does it stop after the first image and why does it chooose always a certain image to be the first one? why are there diff. behaviours on different systems (local <-> server; mac <-> pc; …)
the code:
#initclip 1
ImageFader = function () {
this.__init__ ();
};
ImageFader.prototype = new MovieClip ();
// ** init class ** //
ImageFader.prototype.__init__ = function () {
this._xscale = 100
this._yscale = 100
this.bounding_box.unloadMovie()
this._fader_.unloadMovie()
this._dataProvider = new Array ();
this._count = Math.floor(Math.random() * 2);
this._depth = 1;
this.lenght()
this._isLoaded = -1;
if (this._S_) {
clearInterval (this._S_);
}
if (this._xmlfile != "") {
this.loadXML (this._xmlfile);
}
};
// *** load the external xml ** //
ImageFader.prototype.loadXML = function (x) {
var _xml = new XML ();
_xml.ignoreWhite = true;
_xml.path = this;
_xml.load (x);
_xml.onLoad = function () {
for (var a = 0; a < this.firstChild.childNodes.length; a++) {
var _trans = this.firstChild.childNodes[a].attributes.TRANSITION;
var _pause = this.firstChild.attributes.PAUSE
var _img = this.firstChild.childNodes[a].firstChild.nodeValue;
this.path._dataProvider.push ({img:_img, transition:_trans, pause:_pause});
}
this.path.startFading ();
delete this;
};
};
// ** start fading procedure ** //
ImageFader.prototype.startFading = function () {
if (this._dataProvider.length > 1,2) {
this.makeFader(true)
}
};
// ** load images ** //
ImageFader.prototype.makeFader = function (first) {
this._isLoaded = -1;
this._tmp = this.attachMovie ("ImageLoader", "ImageLoader" + this._depth, this._depth++ );
this["ImageLoader" + this._depth]._alphaSpeed = this._alphaSpeed ;
this._old1 = this['ImageLoader' + (this._depth - 1)]
this._old2 = this['ImageLoader' + (this._depth - 2)]
this._tmp.loadHandler ("isLoaded", this._count);
this._tmp.autoStart = false;
this._tmp.transition = this._dataProvider[this._count].transition
this._tmp.loadImage (this._dataProvider[this._count].img);
this._t1 = getTimer()
this.onEnterFrame = function(){
this._t2 = getTimer()
if((this._t2 - this._t1) > this._dataProvider[this._count].pause || first==true){
if(this._isLoaded == this._count || this._isLoaded == 1 && this._count == 0){
delete this.onEnterFrame;
this._tmp.start()
this._old1.fadeOut()
this._old2.removeMovieClip()
if(this._count + 1 < this._dataProvider.length){
this._count++
this.makeFader()
return;
} else {
if(this._loop == true){
this._count = 0
this.makeFader()
}
}
}
}
}
};
// ** which has been loaded ? ** //
ImageFader.prototype.isLoaded = function (num) {
this._isLoaded = num;
};
Object.registerClass ("ImageFader", ImageFader);
#endinitclip
and
#initclip 0
// -----------------------------
// ease out
// -----------------------------
MovieClip.prototype.easeOut = function(x,y,a,b)
{
var x = arguments[0];
var y = arguments[1];
k = new Object();
this.onEnterFrame = function()
{
this.dx = (this.dx + ((x-this._x))/a)/b
this.dy = (this.dy + ((y-this._y))/a)/b
this._x += this.dx;
this._y += this.dy;
};
};
// hide prototype methods
ASSetPropFlags(MovieClip.prototype, 'drawCircle',0)
ASSetPropFlags(MovieClip.prototype, 'easeOut',0)
// ****************************
// ImageLoader Class
// ****************************
ImageLoader = function () {
this.hasLoaded = false;
this.autoStart = false;
this.transition = 1
};
ImageLoader.prototype = new MovieClip ();
// loadHandler
ImageLoader.prototype.loadHandler = function (callback, c) {
this.callback = callback;
this.callback_num = c;
};
// execute handler once loaded
ImageLoader.prototype.executeHandler = function () {
if (this.hasLoaded == false) {
this._parent[this.callback] (this.callback_num);
this.hasLoaded = true;
}
if (this.autoStart) {
this.executeCallBack ();
}
};
// start transition
ImageLoader.prototype.start = function () {
this.executeCallBack ();
};
// load ext image
ImageLoader.prototype.loadImage = function (img) {
this.img = img;
this.createEmptyMovieClip ("clip", 1);
this.clip._alpha = 0;
this.clip.loadMovie (this.img);
this.preloadImage ();
};
// preload image
ImageLoader.prototype.preloadImage = function () {
this.onEnterFrame = function () {
if (this.clip._url != this._url && this.clip.getBytesLoaded () >= this.clip.getBytesTotal () && this.clip.getBytesTotal () > 4) {
delete this.onEnterFrame;
this.executeHandler ();
}
};
};
// finish loading
ImageLoader.prototype.executeCallBack = function () {
/*
when transition is 0 then make a random
transition effect based on the number of
transition functions
*/
var num_of_transition = 11 // you can add your own transition function
if(this.transition == 0){
this.transition = random(num_of_transition) + 1
//this.transition = 11
}
if(this.transition == 1){
this.onEnterFrame = function () {
if (this.clip._alpha > 100) {
this.clip._alpha = 100;
delete this.onEnterFrame;
}
this.clip._alpha += this._alphaSpeed;
};
} else {
this['transition' + this.transition]()
}
};
// finish loading
ImageLoader.prototype.fadeOut = function () {
var a = 5;
while(this['mask'+a] != undefined){
this['mask'+a].unloadMovie()
this['clip'+a].unloadMovie()
a++
}
this.clip._alpha = 100
};
Object.registerClass ("ImageLoader", ImageLoader);
#endinitclip
suggesstions are highly appreciated.
yours,
m