XML FLV Gallery

I’m trying to build an XML gallery for flash video - similiar to the XML Photo Gallery with thumbnails tutorial found on Kirupa… basically, want a new FLV to load into my player (which is already built and working) when the user clicks on a thumbnail in the thumbnail scroller.

The tutorial only shows how to link to external URL’s, and I need to call a function within flash.

Anyone know or can point me in the right direction?

thanks.

bumpy bumpy.

lookthis: [COLOR=“DarkSlateGray”]http://www.macromedia.com/devnet/flash/articles/video_player.html?trackingid=DERS[/COLOR]

ok cool - but thats a bit more complicated than what I would like - does anyone know of a simplified way of doing this? I would really like to integrate that into the kirupa xml type gallery (just b/c i’m more familiar with it)

I had a similar problem a while ago and the biggest help for me was some of Sens tutorials here on Kirupa

http://www.kirupa.com/web/xml/index.htm

The squirrel finder example should be a good indication of what you need.

If not let me know cause I had to build something similar to what you’re looking for. If you need it let me know and I can PM you the fla and the xml, but I think those tuts will be a help

:cool:

thanks - i’ll check it out although I think i’ve gone through most of that before. I’ll keep you posted if i need assistance.

but before i go - my basic problem which i haven’t been able to figure out is how to call specific functions via xml… if that makes sense. (ie. when the user clicks on the thumbnail the xml will load the accompaning flv into the player within flash)

i know how to create (external) links via xml as shown on kirupa, but i’m getting stuck when trying to use the xml to initiated something within the flash movie itself…

<a href=‘asfunction:nameOfYourFunction,params’>Click Here</a>

If I understand what you want, then that’s what you need.

ok, first I called the mx.controls function to create an object called my_video (which by the way is the same name as a MediaDisplay in my movie)

import mx.controls.MediaPlayback;
var my_video:MediaPlayback;

then load the xml file


menu_xml = new XML();
menu_xml.ignoreWhite = true;
menu_xml.onLoad = function(ok){
	if (ok){	CreateMainMenu(380, 20, 0, this); 	}
};

Now once the file is loaded it should call the function CreateMainMenu


CreateMainMenu = function(x, y, depth, menu_xml){
	GenerateMenu(this, "mainmenu_mc", x, y, depth, menu_xml.firstChild);
};

this in turn will call a function called GenerateMenu


GenerateMenu = function(container, name, x, y, depth, node_xml)
	// variable declarations
	var curr_node,curr_item,ynumber;
	
	var curr_menu = emptymovie.createEmptyMovieClip(name, depth);
		
	for (var i=0; i<node_xml.childNodes.length; i++) {
		// item submenu behavior for rollover event
		
		if (node_xml.childNodes*.nodeName == "interview"){
			curr_item = curr_menu.attachMovie("listmenuitem","item"+i+"_mc",i);
						
			curr_item._x = xnumber;
			curr_item._y = ynumber;
			ynumber = ynumber + 42;
			curr_node = node_xml.childNodes*;
			
			curr_item.txtbox.text = curr_node.attributes.textboxvalue;
			curr_item.node_xml = curr_node;
								
			curr_item.action = curr_node.attributes.action;
			curr_item.variables = curr_node.attributes.movloc;
			
			curr_item.onRelease = function(){
				Actions[this.action](this.variables);
			}
		} 
	} // for
} // function

sorry for some of the dumb names but it’s my job security to make sure no-one else can decipher it :wink:

curr_menu is just an empty movie created. It is only used to attach another movie to.
inside the for loop there is a movie being created for each entry in the xml file (using the param to position it)
the movie is called listmenuitem (its also called this in the library), this is a movie which contains a dynamic text box called txtbox

as you can see the txtbox value is being taken from the XML file, meaning the text for my buttons is coming from the XML file.

it then sets two values, one being the actions the other being the variables…here is a snippet of my XML


<interview textboxvalue="Text for button one" action="PlayMovie" movloc="mymovie.flv"/>	

then it sets the onrelease function to use an object called Actions passing it the 2 values you just set

now how to make the actions work…

outside of the GenerateMenu function and before you load the XML file paste this code


Actions = Object();
Actions.PlayMovie = function(movie){
	my_video.contentPath = movie;
}

you can see from my XML you’ll be calling the function in the actions object called playmovie passing it the movie param which is the url to your flv movie. this means when someone clicks one of your buttons you’ve created the my_video (mediadisplay) on your stage will change contentpath and show a different movie…

I got a lot of this from the Macromedia pdfs available on their site (well Adobe now)

and obviously a lot of it from Sens tutorials :thumb:

hope this help :cool:

holy crap - THANKS for the indepth response!!
I will see what I can do… let you know if i have any questions.
cheers