Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 01-02-2006, 14:01   #1 (permalink)
n00b
 
Registriert seit: Jun 2005
Beiträge: 271
aus image galerie eine video galerie machen?

hi, ich habe eine image gallerie die, die bilder pfade aus einen xml file holt.
klappt super.

jetzt möchte ich aber anstatt der bilder videos anzeigen. kann mir jemand einen tipp geben was ich ändern muss um anstatt den bildern videos anzuzeigen?

hier mein bisheriger code:

Code:
// SETTING VARIABLES
currentpage = 1;
_global.whichalbum = 1;
bigframew = 614;
bigframeh = 408;

//////////////////////////////////
function scalerf(w,h)
{
	diffw = (w-bigframew);
	diffh = (h-bigframeh);
	
	if(diffw<=0&&diffh<=0)
	{
		scaler = 1 * 100;
	}
	else if (diffw==Math.max(diffw,diffh)) //scale to height
	{
		scaler = (bigframew/w) * 100;	
	}
	else if (diffh==Math.max(diffw,diffh)) //scale to width
	{
		scaler = (bigframeh/h) * 100;
	}
	return scaler;
}

//LOADCLIP ACTIVITIES
_root.createEmptyMovieClip("looploop",-1000);
var my_mcl = new MovieClipLoader();
myListener = new Object();
myListener.onLoadStart = function (target_mc) 
{
var loadProgress = my_mcl.getProgress(target_mc);
}
myListener.onLoadProgress = function (target_mc, loadedBytes, totalBytes) 
{
////////////////////////////////////////////////////////
// FOR PRELOADER PURPOSES
loaded = loadedBytes;
total = totalBytes;
percentage = Math.round(100*(loaded/total));
trace(percentage);
progressbar_mc.progresser_mc._xscale = percentage;
//percent_txt.text = percentage+"%";
////////////////////////////////////////////////////////
}
myListener.onLoadComplete = function (target_mc) 
{
var loadProgress = my_mcl.getProgress(target_mc);
imageframe_mc.hold._alpha=0;
velo = 0;	
imageframe_mc.hold.onEnterFrame = function()
	{
		w = imageframe_mc.hold._width;
		h = imageframe_mc.hold._height;
		if(w!=0&&h!=0)
		{
			scaler = scalerf(w,h);
			if(scaler!=100)
			{
			imageframe_mc.hold._xscale = scaler;
			imageframe_mc.hold._yscale = scaler;
			}
			imageframe_mc.hold._x = (bigframew - (w*(scaler/100)))/2;
			imageframe_mc.hold._y = (bigframeh - (h*(scaler/100)))/2;
						
		
		if(imageframe_mc.hold._alpha<100)
			{
			accel = 0.3;
			velo = velo + accel;
			imageframe_mc.hold._alpha +=velo;
			
			}
				
		}
	}
}


myListener.onLoadInit = function (target_mc) 
{
//target_mc._width = 100;
//target_mc._width = 100;
} 
myListener.onLoadError = function (target_mc, errorCode) 
{
 } 
my_mcl.addListener(myListener);


///////////////////////////////////////////////////////////////
// XML PARSING
function imageListLoaded(whichalbum) {
	//clear stage
	for (var rr = 0; rr < noofrow * noofcolumn; rr++)
	{
			rr = rr + pageindex;
			this["thumbframe"+rr].removeMovieClip();
			this["thumbframein_mc"+rr].removeMovieClip();
			rr = rr - pageindex;
	}

	//parameters
	param = this.imageList_xml.firstChild.firstChild;
	pc = int(param.attributes.noofcolumn);
	pr = int(param.attributes.noofrow);
	ptx = int(param.attributes.thumbxs);
	pty = int(param.attributes.thumbys);	
	_global.ptw = int(param.attributes.thumbwidth);
	_global.ptl = int(param.attributes.thumbheight);
	//////////////////////////////////////////////////////////////	
	var albumCountXML = this.imageList_xml.firstChild.childNodes;
	albumCount = albumCountXML.length - 1;

	var mainNode = this.imageList_xml.firstChild.childNodes[whichalbum].firstChild;
	var listBoxData = createResourceList (mainNode.childNodes,pc,pr,ptx,pty,ptw,ptl);
	
	albumtextbox.text = "album"+whichalbum+">>>";
//	albumtextbox.background = true;
//	albumtextbox.backgroundColor = 0xff0000;
	for (t=1;t<=albumCount;t++)
	{
		/////////////////////////////////////////////////////////////
		//Creating text box
		this.createEmptyMovieClip("albumnames"+t,900+t);
		albumname_mc = this["albumnames"+t];
		albumname_mc.createTextField("albumnametxt"+t,1000+t,0,40,100,20);
		var my_fmt:TextFormat = new TextFormat();
		my_fmt.color = 0x000000;
		my_fmt.font = "Verdana"
		my_fmt.size = 10;
		albumname_mc["albumnametxt"+t].text = this.imageList_xml.firstChild.childNodes[t].attributes.albumname;
		albumname_mc["albumnametxt"+t].setTextFormat(my_fmt);
		albumname_mc._x = 710;
		albumname_mc._y = t * 20;
		albumname_mc.sett = t;
		albumname_mc.onRelease = function()
		{
		currentpage = 1;		
		filename.text = "";
		for (var rr = 0; rr < noofrow * noofcolumn; rr++)
		{
			rr = rr + pageindex;
			this["thumbframe"+rr].removeMovieClip();
			this["thumbframein_mc"+rr].removeMovieClip();
			rr = rr - pageindex;
		}
		imageListLoaded(this.sett)
		_global.whichalbum = this.sett;
		}
	}
	

}


function createResourceList(resource_array,noofcolumn,noofrow,thumbxs,thumbys,thumbwidth,thumblength,bigimagewidth) {
	_global.noofcolumn = noofcolumn;
	_global.noofrow = noofrow;
	var listData = new DataProviderClass ();
	resourceCount = resource_array.length;
	noofpage = Math.ceil(resourceCount/(noofcolumn*noofrow));
	ofof.text = "page: "+currentpage+"/"+noofpage;
	var resource, image, tmb;
	images = new Array();
	infotexts = new Array();
	
	pageindex =((currentpage-1) * noofrow *  noofcolumn);
	
	for (var r = 0; r < noofrow; r++)
	{
		
		for (var c = 0; c < noofcolumn; c++) {
			i = (r * noofcolumn) + c + pageindex;
			
			if(i<resourceCount)
				{
					nodigits = new String(resourceCount);
					resource = resource_array[i];
					images[i] = resource.attributes.imagename;
					infotexts[i] = resource.attributes.infotext;
					loadme = "thumbs/"+images[i];
					findme = images[i];
					whichframe = "frame"+i;
					this.attachMovie("thumbframe","thumbframe"+i,i+1);
					this["thumbframe"+i]._x = (c * thumbwidth)+thumbxs;
					this["thumbframe"+i]._y = (r * thumblength)+thumbys;
					createEmptyMovieClip("thumbframein_mc"+i,(i+1)*1000);					
					onEnterFrame = function()
					{
						for (var tr = 0; tr < noofrow; tr++)
						{
							
							for (var tc = 0; tc < noofcolumn; tc++) {
								ti = (tr * noofcolumn) + tc + pageindex;
								
								if(ti<resourceCount)
									{
											tw = this["thumbframein_mc"+ti]._width;
											th = this["thumbframein_mc"+ti]._height;
											this["thumbframein_mc"+ti]._x = this["thumbframe"+ti]._x+(thumbwidth - tw)/2;
											this["thumbframein_mc"+ti]._y = this["thumbframe"+ti]._y+(thumblength - th)/2;
											
									}
							}
						}
					}
					this["thumbframein_mc"+i].loadMovie(loadme);
					noofthumbs = (currentpage-1) * noofcolumn * noofrow;
					nom = noofthumbs;
					callbig(nom);
					this.filename.text = " "+images[nom];
					this["thumbframe"+i].onPress = function()
						{
							startsubstring = 10;
							endsubstring = startsubstring + nodigits.length;
							largeindex=this._name.substring(startsubstring,endsubstring);
							callbig(largeindex);
						}
				}
			}
	}
}

function callbig(index)
{
	filename.text = " "+images[index];
	info.text = infotexts[index];
	imageframe_mc.createEmptyMovieClip("hold",0);

	my_mcl.loadClip("largeimages/"+images[index],this.imageframe_mc.hold);
	imageframe_mc.onPress = function()
	{getURL("largeimages/"+images[index],"_blank");}	

}



imageList_xml = new XML ();
imageList_xml.ignoreWhite = true;
imageList_xml.onLoad = function (success) {
	if (success) {
		imageListLoaded(whichalbum);
		}
};

//////////////////////////////////////////
//HERE IS WHERE YOU DECLARE YOUR XML FILE
imageList_xml.load ("albums.xml");
//////////////////////////////////////////

rightbt.onRelease=function()
{
	if(currentpage != noofpage)
	{
		currentpage ++;
		imageListLoaded(_global.whichalbum);
	}
}

leftbt.onRelease=function()
{
	if(currentpage > 1)
	{
		currentpage --;
		imageListLoaded(_global.whichalbum);
	}
}
stop();
wäre für jeden tipp dankbar!

gruß
phase
__________________
--
Don't eat yellow snow
phase ist offline   Mit Zitat antworten
Alt 01-02-2006, 14:23   #2 (permalink)
°.oO°O.o°.oO.o°O
 
Benutzerbild von bamboocha
 
Registriert seit: Jun 2005
Ort: CH
Beiträge: 1.490
Du kannst nicht einfach so Videos in Flash reinladen und abspielen funktioniert leider nicht... :-(
Da musst du schon über das FLV-Format gehen und auch da werden nicht alle Formate unterstützt! Am Besten guckst du mal in die Flash-Hilfe!
(Dafür hast du mit FLV die Möglichkeit, die Videos zu streamen!)
__________________
There is no way to happiness, happiness is the way! - Buddha
bamboocha ist offline   Mit Zitat antworten
Alt 01-02-2006, 15:15   #3 (permalink)
n00b
 
Registriert seit: Jun 2005
Beiträge: 271
Zitat:
Zitat von bamboocha
Du kannst nicht einfach so Videos in Flash reinladen und abspielen funktioniert leider nicht... :-(

ja, hab ich mittlerweile gemerkt ;-(

aber ich kann doch anstatt der bilder swf laden die wiederum ein flv streamen oder?
__________________
--
Don't eat yellow snow
phase ist offline   Mit Zitat antworten
Alt 01-02-2006, 15:16   #4 (permalink)
°.oO°O.o°.oO.o°O
 
Benutzerbild von bamboocha
 
Registriert seit: Jun 2005
Ort: CH
Beiträge: 1.490
Ja, das kannst du machen... du kannst aber auch direkt die FLV's streamen ohne Umweg über ne weitere SWF!
__________________
There is no way to happiness, happiness is the way! - Buddha
bamboocha ist offline   Mit Zitat antworten
Alt 01-02-2006, 15:20   #5 (permalink)
n00b
 
Registriert seit: Jun 2005
Beiträge: 271
Zitat:
Zitat von bamboocha
Ja, das kannst du machen... du kannst aber auch direkt die FLV's streamen ohne Umweg über ne weitere SWF!

hhmm... und wie? möchte an der galerie sowenig wie möglich umbauen. weil nciht so viel zeit. gibt es eine art player der flv streamt?
__________________
--
Don't eat yellow snow
phase 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:40 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele