Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 21-05-2006, 17:54   #1 (permalink)
Neuer User
 
Registriert seit: Apr 2005
Beiträge: 21
Hilfe bei Skalierung...

Hallo,

ich habe hier ein Script bei dem die Bilder irgenwie scaliert werden aber ich verstehe das script in diesem Punkt nicht. Kann mir das jemand erklären, ich möchte es in dem Punkt nämlich abwandeln bzw. die scalierung entfernen.
Ich stelle mal das ganze script rein...

Vielen Dank für eure Hilfe!

Code:
var main = this;
thumbpath = "miniaturen/";
picpath = "pics/";
slidetime = 1;
faktor = 0;
auscount = 0;
kino.an = 0;
bcount = 10;
buttonarr = [];
texte = [];
texte2 = [];
files = [];
bgcol = 0xFFFFFF;
maxb = display._width;
maxh = display._height;
textfarbe = new TextFormat();
textfarbe.color = 0x000000;
textfarbe.font = "Verdana";
textfarbe.size = 10;
//textfarbe.align = "center";
txt.backgroundColor = 0xF4F2F2;
txt.borderColor = 0xF4F2F2;
txt.text = "willkommen";
txt.setNewTextFormat(textfarbe);
txt2.backgroundColor = 0xF4F2F2;
txt2.borderColor = 0xF4F2F2;
txt2.text = "willkommen";
txt2.setNewTextFormat(textfarbe);
var m = new XML();
m.ignoreWhite = true;
m.onLoad = function(ok) {
	if (ok) {
		anzahl = this.firstChild.childNodes.length;
		for (var i = 0; i<=anzahl; i++) {
			texte[i] = [];
			texte2[i] = [];
			files[i] = [];
			texte[i].push(this.firstChild.childNodes[i].attributes.texte);
			texte2[i].push(this.firstChild.childNodes[i].attributes.texte2);
			files[i].push(this.firstChild.childNodes[i].attributes.titel);
		}
		txt.text = texte[0];
		txt2.text = texte2[0];
		dis.laden(1);
		create();
	}
};

m.load("files.xml");
//?rand="+random(9999))
MovieClip.prototype.paint = function(farbe, breite, hoehe, alpha) {
	with (this) {
		moveTo(0, 0);
		lineStyle(0, farbe, 0);
		beginFill(farbe, alpha);
		lineTo(breite, 0);
		lineTo(breite, hoehe);
		lineTo(0, hoehe);
		lineTo(0, 0);
		endFill();
	}
};
create = function () {
	for (var i = 1; i<=anzahl; i++) {
		var control = prev.holder.createEmptyMovieClip('control'+i, -i+100);
		control.id = i;
		var mc = prev.holder.createEmptyMovieClip('holder'+i, -i);
		mc._y = -25;
		mc._x = (i-1)*65+4;
		mc.loadMovie(thumbpath+files[i-1], 0);
		buttonarr.push(mc);
		control.onEnterFrame = function() {
			if (this._parent["holder"+this.id]._width>0) {
				var mc1 = this._parent["holder"+this.id];
				mc1.id = this.id;
				mc1.onPress = function() {
					var dis = display.createEmptyMovieClip("anzeige"+bcount, bcount);
					bcount++;
					aus();
					dis.laden(this.id);
					txt.text = texte[this.id-1];
					txt2.text = texte2[this.id-1];
				};
				delete this.onEnterFrame;
			}
		};
	}
};
MovieClip.prototype.moveleft = function(ziel, breite) {
	if (this._x>(-breite+520)) {
		this.onEnterFrame = function() {
			this._x += (-this._x+ziel)*.3;
			if (Math.round(this._x) == ziel) {
				this._x = ziel-2;
				delete this.onEnterFrame;
				left.enabled = right.enabled=true;
				
			}
		};
	} else {
		left.enabled = right.enabled=true;
		 
		
		
		
	}
};
MovieClip.prototype.moveright = function(ziel, breite) {
	if (this._x<-500) {
		this.onEnterFrame = function() {
			this._x += (-this._x+ziel)*.3;
			if (Math.round(this._x) == ziel) {
				this._x = ziel+2;
				delete this.onEnterFrame;
				left.enabled = right.enabled=true;
				
			}
		};
	} else {
		left.enabled = right.enabled=true;
		
	}
};
MovieClip.prototype.posit = function(aktu) {
	if (this._width<this._height) {
		count = 1;
		faktor = this._width/this._height;
	} else {
		count = 0;
		faktor = this._height/this._width;
	}
	trace(count+"  "+faktor);
	if (faktor == 1 && this._height>maxh) 
	{
		this._height = this._width=maxh-2;
	}
	if (faktor<1 && count == 0) 
	{
		if (this._width>maxb-2) 
		{
			this._width = maxb-2;
			this._height=this._width*faktor
			if (this._height>maxh-2) 
			{
				this._height = (maxh-2);
				this._width = (this._height-2)/faktor;
			} 
		}
	}
	if (faktor<1 && count == 1) 
	{
		this._height = maxh-2;
		this._width = (maxh-2)*faktor;
	}
	this._x = -this._width/2;
	this._y = -this._height/2;
	this.onEnterFrame = function() {
		if (this._alpha<100) {
			this._alpha += 2;
			display["anzeige"+(bcount-2)]._alpha -= 2;
		} else {
			delete this.onEnterFrame;
			display["anzeige"+(bcount-2)].removeMovieClip();
			an();
			if (kino.an == 1) {
				slide();
			}
		}
	};
};
MovieClip.prototype.laden = function(id) {
	main.aktu = id;
	this.createEmptyMovieClip("flaeche", 1);
	this.flaeche._x = -display._width/2+2;
	this.flaeche._y = 142;
	this.createEmptyMovieClip("hold", 0);
	this.createEmptyMovieClip("status", 2);
	this.createEmptyMovieClip("texte", 3);
	this.createEmptyMovieClip("texte2", 3);
	this.texte.createTextField("txt", 0, 0, -20, 200, 20);
	this.texte.txt.setNewTextFormat(textfarbe)
	this.texte2.createTextField("txt2", 0, 0, -20, 200, 20);
	this.texte2.txt2.setNewTextFormat(textfarbe)
	this.hold.loadMovie(picpath+files[id-1], 0);
	this.hold._alpha = 0;
	this.texte._x = -100;
	this.texte._y = 260;
	this.texte2._x = -100;
	this.texte2._y = 260;
	this.status.paint(0x00, 200, 2, 100);
	this.status._xscale = 0;
	this.flaeche.paint(bgcol, display._width-4, 0, 100);
	this.status._x = -100;
	this.status._y = 260;
	this.status.onEnterFrame = function() {
		prozent = this._parent.hold.getBytesLoaded()/this._parent.hold.getBytesTotal()*100;
		if (this._parent.hold.getBytesTotal()<=0) {
			this._parent.texte.txt.text = "searching... "+files[id-1];
		} else {
			this._parent.texte.txt.text = "loading... "+files[id-1]+"  "+this._parent.hold.getBytesTotal()+"  b total";
		}
		this._parent.texte.txt.setTextFormat(textfarbe);
		if (this._parent.hold._width>0) {
			this._parent.hold.posit();
			this._parent.texte.removeMovieClip();
			this._parent.flaeche.removeMovieClip();
			this.removeMovieClip();
		} else {
			this._xscale += (-this._xscale+prozent)*.3;
		}
	};
};
right.onPress = function() {
	this.enabled = left.enabled=false;
	breite = prev.holder._width;
	prev.holder.moveright(Math.round(prev.holder._x+520), breite);
};
left.onPress = function() {
	this.enabled = right.enabled=false;
	breite = prev.holder._width;
	prev.holder.moveleft(Math.round(prev.holder._x-520), breite);
};
up.onPress = function() {
	this.onEnterFrame = function() {
		txt.scroll += 1;
	};
};
up.onRelease = function() {
	delete this.onEnterFrame;
};
down.onPress = function() {
	this.onEnterFrame = function() {
		txt.scroll -= 1;
	};
};
down.onRelease = function() {
	delete this.onEnterFrame;
};
function aus() {
	for (var i = 0; i<buttonarr.length; i++) {
		buttonarr[i].enabled = 0;
	}
	rueck.enabled = 0;
	vor.enabled = 0;
	left.enabled = 0;
	right.enabled = 0;
	kino.an == 0 ? kino.enabled=0 : kino.enabled=1;
}
function an() {
	if (auscount == 0) {
		for (var i = 0; i<buttonarr.length; i++) {
			buttonarr[i].enabled = 1;
		}
		rueck.enabled = 1;
		vor.enabled = 1;
		left.enabled = 1;
		right.enabled = 1;
		kino.enabled = 1;
	}
}
rueck.onPress = function() {
	if (main.aktu>1) {
		var dis = display.createEmptyMovieClip("anzeige"+bcount, bcount);
		bcount++;
		aus();
		dis.laden(main.aktu-1);
		txt.text = texte[main.aktu-1];
		txt2.text = texte2[main.aktu-1];
	}
};
vor.onPress = function() {
	if (main.aktu<anzahl) {
		var dis = display.createEmptyMovieClip("anzeige"+bcount, bcount);
		bcount++;
		aus();
		dis.laden(main.aktu+1);
		txt.text = texte[main.aktu-1];
		txt2.text = texte2[main.aktu-1];
	}
};
kino.onPress = function() {
	if (this.an == 0) {
		aus();
		slide();
		this.enabled = 1;
		this.an = 1;
		this.txt.text = "stop";
		auscount = 1;
		txt.text = "loading slideshow...";
	} else if (this.an == 1) {
		this.an = 0;
		this.txt.text = "Diashow";
		auscount = 0;
		//an()
	}
};
slide = function () {
	inter = setInterval(function () { clearInterval(inter);delete inter;var dis = display.createEmptyMovieClip("anzeige"+bcount, 
bcount);bcount++;if (main.aktu<anzahl) {dis.laden(main.aktu+1);txt.text = texte[main.aktu-1];txt2.text = texte2[main.aktu-1];} else 
{dis.laden(1);txt.text = texte[0];txt2.text = texte2[0];}}, slidetime*1000);
};
var dis = display.createEmptyMovieClip("anzeige"+bcount, bcount);
bcount++;
aus();
txt.setTextFormat(textfarbe);
txt2.setTextFormat(textfarbe);
kai.budich ist offline   Mit Zitat antworten
Alt 21-05-2006, 17:57   #2 (permalink)
Flashworker
 
Benutzerbild von sebastian
 
Registriert seit: Nov 2001
Ort: Wiesbaden
Beiträge: 10.945
Du verstehst die restlichen 300 Zeilen?

Ohne mich jetzt mit diesem Script zu befassen: Nehme doch einfach alles raus, was mit _xscale und _yscale zu tun hat.
sebastian ist offline   Mit Zitat antworten
Alt 21-05-2006, 18:10   #3 (permalink)
Neuer User
 
Registriert seit: Apr 2005
Beiträge: 21
Die meisten der 300 zeilen vertsehe ich schon, ich bin aber eher ein Anfänger in Sachen Flash. Meine Stärken liegen eher bei PHP.

Ich habe natürlich rumprobiert und alles was mit scale zu tun hat rausgenommen, das hat aber nichts bewirkt und die bilder werden immernoch aufgezogen, auf etwa das 1,8fache.

Woran, ausser an scale, könnte das noch liegen?
kai.budich ist offline   Mit Zitat antworten
Alt 21-05-2006, 18:19   #4 (permalink)
Flashworker
 
Benutzerbild von sebastian
 
Registriert seit: Nov 2001
Ort: Wiesbaden
Beiträge: 10.945
An _width und _height

Vielleicht musst du die maxwidth bzw maxheight im Script anpassen. Nichts für ungut, aber ich vollzieh jetzt nicht die 300 Zeilen im Detail nach
sebastian ist offline   Mit Zitat antworten
Alt 21-05-2006, 18:34   #5 (permalink)
Neuer User
 
Registriert seit: Apr 2005
Beiträge: 21
das verlangt auch keiner...

aber dein Hinweis hat mich gerade auf die richtige Fährte geführt. Das Hauptbild (display.)habe ich schon auf die richtige Grösse aber die Vorschaubilder sträuben sich noch.
kai.budich ist offline   Mit Zitat antworten
Alt 21-05-2006, 18:35   #6 (permalink)
Flashworker
 
Benutzerbild von sebastian
 
Registriert seit: Nov 2001
Ort: Wiesbaden
Beiträge: 10.945
Zitat:
Zitat von kai.budich
aber dein Hinweis hat mich gerade auf die richtige Fährte geführt.
Gut, so muss es sein
sebastian ist offline   Mit Zitat antworten
Alt 21-05-2006, 20:01   #7 (permalink)
Neuer User
 
Registriert seit: Apr 2005
Beiträge: 21
also das mit den Vorschaubilder klappt noch nicht, da muss ich noch etwas rumprobieren aber vielleicht kannst du mir bei einem anderen Problem helfen.

Ich habe zwei Navipfeile left und right, welche bei einer bestimmten Position der Leiste inaktiv werden. Ich hätte aber gern das sie in dem Fall verschwinden.

Ich habe es mit _visible=false versucht aber offensichtlich nicht richtig gemacht. Die Pfeile verschwinden nämlich nicht. Oder gleich ganz.

Code:
MovieClip.prototype.moveleft = function(ziel, breite) {
	if (this._x>(-breite+520)) {
		this.onEnterFrame = function() {
			this._x += (-this._x+ziel)*.3;
			if (Math.round(this._x) == ziel) {
				this._x = ziel-2;
				delete this.onEnterFrame;
				left.enabled = right.enabled=true;			
			}
		};
	} else {
		left.enabled = right.enabled=true;	
	}
};
MovieClip.prototype.moveright = function(ziel, breite) {
	if (this._x<-500) {
		this.onEnterFrame = function() {
			this._x += (-this._x+ziel)*.3;
			if (Math.round(this._x) == ziel) {
				this._x = ziel+2;
				delete this.onEnterFrame;
				left.enabled = right.enabled=true;
				
			}
		};
	} else {
		left.enabled = right.enabled=true;
		
	}
};
Code:
right.onPress = function() {
	this.enabled = left.enabled=false;
	breite = prev.holder._width;
	prev.holder.moveright(Math.round(prev.holder._x+520), breite);
};
left.onPress = function() {
	this.enabled = right.enabled=false;
	breite = prev.holder._width;
	prev.holder.moveleft(Math.round(prev.holder._x-520), breite);
};
kai.budich 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 15:22 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele