Zurück   Flashforum > Flash > ActionScript > ActionScript 3

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 23-11-2009, 18:39   #1 (permalink)
Neuer User
 
Registriert seit: Nov 2008
Beiträge: 17
Unhappy as2 scroller in as3 umwandeln

Hallo Ihr lieben!

Ich habe mir etwas zusammengebastelt in as2.
Funktioniert auch super!

Leider brauch ich das jetzt in as3 und ich bekomme es einfach nicht hin.
Dafür bin ich nicht gut genug in as3.

Aber evtl. kann mir ja jemand helfen

THX

twinsspirit

Code:

function loadXML(loaded) {
	if (loaded) {
		xmlNode = this.firstChild;
		image = [];
		description = [];
		thumbnails = [];
		total = xmlNode.childNodes.length;
		for (i=0; i<total; i++) {
			image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
			description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
			thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
			thumbnails_fn(i);
		}
		firstImage();
	} else {
		content = "file not loaded!";
	}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");






listen = new Object();
listen.onKeyDown = function() {
	if (Key.getCode() == Key.LEFT) {
		
	} else if (Key.getCode() == Key.RIGHT) {
		
	}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
	prevImage();
};
next_btn.onRelease = function() {
	nextImage();
};


Key.addListener(listen);
hit_left.onRelease = function() {
	teaserScrollerBack();
};
hit_right.onRelease = function() {
	teaserScrollerNext();
};



///////////////////////////////////// 
p = 0;
this.onEnterFrame = function() {
	filesize = picture.getBytesTotal();
	loaded = picture.getBytesLoaded();
	preloader._visible = true;
	if (loaded != filesize) {
		preloader.preload_bar._xscale = 100*loaded/filesize;
	} else {
		preloader._visible = false;
		if (picture._alpha<100) {
			picture._alpha += 10;
		}
	}
};
function nextImage() {
	if (p<(total-1)) {
		p++;
		if (loaded == filesize) {
			picture._alpha = 0;
			picture.loadMovie(image[p], 1);
			
		}
	}
}
function prevImage() {
	if (p>0) {
		p--;
		picture._alpha = 0;
		picture.loadMovie(image[p], 1);

	}
}
function firstImage() {
	if (loaded == filesize) {
		picture._alpha = 0;
		picture.loadMovie(image[0], 1);
		desc_txt.text = description[0];
		picture_num();
	}
}

/////////TEASER SCROLLER////////

///////////START//////////
hit_right._x= 430;
hit_left._x= 100;
thumbnail_mc._x = 20;

if (thumbnail_mc._x==20) {
	
	hit_left._visible = false;
	}
	
///////////////////////////////////// 

function teaserScrollerNext() {
	thumbnail_mc._x = thumbnail_mc._x-i*7;
	if (thumbnail_mc._x<0) {
	hit_left._visible = true;
	}
	if (thumbnail_mc._x<-i*65) {
	hit_right._visible = false;
	}
	
		}

function teaserScrollerBack() {
	
	thumbnail_mc._x = thumbnail_mc._x+i*7;
	if (thumbnail_mc._x>0) {
	hit_right._x= 430;
	}
	if (thumbnail_mc._x>-(i-6)*65) {
	hit_right._visible = true;
	}
	if (thumbnail_mc._x>20) {
	hit_left._visible = false;
	}
	
}


/////////////////
function picture_num() {
	current_pos = p+1;
	pos_txt.text = current_pos+" / "+total;
}

	
function thumbnails_fn(k) {
	thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
	tlistener = new Object();
	tlistener.onLoadInit = function(target_mc) {
		target_mc._x = hit_left._x+(target_mc._width+5)*k;
		target_mc.pictureValue = k;
		target_mc.onRollOver = function() {
			p = this.pictureValue-1;
			nextImage();
					desc_txt.text = description[p];
		picture_num();
		};
		target_mc.onRelease = function() {
			this._alpha = 50;
			
			desc_txt.text = description[p];
			picture_num();
		};
		target_mc.onRollOut = function() {
			this._alpha = 100;
		};
	};
	image_mcl = new MovieClipLoader();
	image_mcl.addListener(tlistener);
	image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
twinsspirit ist offline   Mit Zitat antworten
Alt 23-11-2009, 18:47   #2 (permalink)
CodeGecko
 
Benutzerbild von hellslawyer
 
Registriert seit: Aug 2007
Ort: Hagen
Beiträge: 1.242
Wo hapert es denn? Ich wage zu bezweifeln, dass Dir jemand das komplett Skript mal eben in AS3 umwandeln wird. Von daher nenn doch bitte konkret, wo es hakt.
__________________
Grütze Reinhart

XING || Simple Flash-Filter-Generator || DateChooser (AS3)
MovieClipLoader-Example (AS2) || PreloaderClass (AS2) || Framechecker-Component (AS2)

Bitte keine Flashfragen per PN oder ICQ. Dafür ist das Forum da.
hellslawyer ist offline   Mit Zitat antworten
Alt 23-11-2009, 19:26   #3 (permalink)
Neuer User
 
Registriert seit: Nov 2008
Beiträge: 17
was ich bislang hinbekommen habe ;-)

danke für die schnelle Antwort!

Also bis jetzt habe ich das hinbekommen.

Code:
function loadXML(loaded) {
	if (loaded) {
		xmlNode = this.firstChild;
		image = [];
		description = [];
		thumbnails = [];
		total = xmlNode.childNodes.length;
		for (i=0; i<total; i++) {
			image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
			description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
			thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
			thumbnails_fn(i);
		}
		firstImage();
	} else {
		content = "file not loaded!";
	}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");



function gofoto2(e:MouseEvent):void{
	teaserScrollerBack();	
}
hit_left.addEventListener(MouseEvent.CLICK, gofoto2 );


function gofoto3(e:MouseEvent):void{
	teaserScrollerNext();	
}
hit_right.addEventListener(MouseEvent.CLICK, gofoto3 );



///////////////////////////////////// 
p = 0;
this.onEnterFrame = function() {
	filesize = picture.getBytesTotal();
	loaded = picture.getBytesLoaded();
	preloader.visible = true;
	if (loaded != filesize) {
		preloader.preload_bar.xscale = 100*loaded/filesize;
	} else {
		preloader.visible = false;
		if (picture.alpha<100) {
			picture.alpha += 10;
		}
	}
};
function nextImage() {
	if (p<(total-1)) {
		p++;
		if (loaded == filesize) {
			var i =new Loader();
i.load(new URLRequest(image[p], 1));
movieClipInstance.addChild(i)
			
		}
	}
}
function prevImage() {
	if (p>0) {
		p--;
i.load(new URLRequest(image[p], 1));
movieClipInstance.addChild(i)

	}
}
function firstImage() {
	if (loaded == filesize) {
i.load(new URLRequest(image[p], 1));
movieClipInstance.addChild(i)
		desc_txt.text = description[0];
		picture_num();
	}
}

/////////TEASER SCROLLER////////

///////////START//////////
hit_right.x= 430;
hit_left.x= 100;
thumbnail_mc.x = 20;

if (thumbnail_mc.x==20) {
	
	hit_left.visible = false;
	}
	
///////////////////////////////////// 

function teaserScrollerNext() {
	thumbnail_mc.x = thumbnail_mc.x-i*7;
	if (thumbnail_mc.x<0) {
	hit_left.visible = true;
	}
	if (thumbnail_mc.x<-i*65) {
	hit_right.visible = false;
	}
	
		}

function teaserScrollerBack() {
	
	thumbnail_mc.x = thumbnail_mc.x+i*7;
	if (thumbnail_mc.x>0) {
	hit_right.x= 430;
	}
	if (thumbnail_mc.x>-(i-6)*65) {
	hit_right.visible = true;
	}
	if (thumbnail_mc.x>20) {
	hit_left.visible = false;
	}
	
}


/////////////////
function picture_num() {
	current_pos = p+1;
	pos_txt.text = current_pos+" / "+total;
}

	
function thumbnails_fn(k) {
	thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
	tlistener = new Object();
	tlistener.onLoadInit = function(target_mc) {
		target_mc.x = hit_left.x+(target_mc._width+5)*k;
		target_mc.pictureValue = k;
		target_mc.onRollOver = function() {
			p = this.pictureValue-1;
			nextImage();
					desc_txt.text = description[p];
		picture_num();
		};
		target_mc.onRelease = function() {
			this.alpha = 50;
			
			desc_txt.text = description[p];
			picture_num();
		};
		target_mc.onRollOut = function() {
			this.alpha = 100;
		};
	};
	image_mcl = new MovieClipLoader();
	image_mcl.addListener(tlistener);
	image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
Leider komm ich da nicht weiter!

Evtl. kannst du mir ja helfen ;-)

ciao Twin
twinsspirit ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Stichworte
as2, as3, flash mx, scroller

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


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Scroller Problem! Scroller will nicht mit Mausrad scrollen ThommyXXL Flash MX 2004 4 22-03-2006 22:45
scroller jhaustein Flash MX 5 30-09-2005 15:27
Umwandeln von MX in Flash 5 (Scroller) bitte um Hilfe Joe123 Flash MX 1 06-12-2004 23:21
Scroller! IFA Flash 4 und Flash 5 2 16-06-2002 23:20
Scroller!! IFA ActionScript 1 8 16-06-2002 17:07


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:08 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele