Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 01-08-2005, 13:10   #1 (permalink)
Neuer User
 
Registriert seit: Jul 2003
Ort: berlin
Beiträge: 60
transitions

hallo

ich habe ein problem.

ich habe diese image-transition:

http://www.marcusscheller.com/tst/template.html

die bilder werden via xml geladen.

meinefrage:
wie verlängere ich die zeit zwischen den einzelenen transitions?
die bilder sollen einfach länger stehen bleiben.

und

warum stoppt die animation immer nach dem letzten bild? und warum sucht sich die animation immer eben dieses letzte bild als erstes bild aus? dieses passiert nur auf dem server, nicht lokal …

das AS:

(ist hier runtergeladen und hat sicher noch bestandteile, die nicht gebraucht werden. aber da ich kein pogrammierer bin muss ich mir halt so helfen )

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
und

Code:
#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
?
alles seehr seltsam
vielen dank im vorraus!!

m

edit: vielleicht geht das alles auch vieel einfacher …

die fla: hier

Geändert von marus_S (01-08-2005 um 13:18 Uhr)
marus_S ist offline   Mit Zitat antworten
Alt 01-08-2005, 15:56   #2 (permalink)
Neuer User
 
Registriert seit: Jul 2003
Ort: berlin
Beiträge: 60
ok. das meiste habe ich nun selbst herausgefunden. stand wohl etwas auf dem schlauch denn es war gross und dick in der xml-datei eingetragen.

nur eines noch: warum stoppt die animation nach dem letzten bild?

lokal tut es das nämlich nicht. nur auf dem server …

gruss

m
marus_S ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 07:27 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele