digitalpencil
Programmer
Hi,
I've been using the videosource tutorial as a guide for creating a dynamic FLV gallery which loads (from an XML file) the paths to some thumbnail jpgs and some itemnames for assembly in a list component. The paths to the FLVs are also loaded from here.
This is working fine, (although needs significant tarting up) but now I would like to add a description box which is also referenced from the XML file. I've tried everything I can think of but I've never been great with it and I just can't figure out where I'm messing it up..
A simplified version of my xml is:
and the code that then loads the XML and assembles the content in the list component is:
All I really want to do is load the descriptions from the xml into a dynamic text field on the main stage instance named 'description'..
I've been trying this for ages now and am feeling pretty dumb 'cause I just can't figure it out.
I'd be really grateful if anyone could spare a moment to take a look and see if they can work out where i'm going wrong here.
If it helps, I've uploaded my files to the following:
(open directory containing all files)
(or, one big zip with everything on it for convenience)
Thanks for reading.
I've been using the videosource tutorial as a guide for creating a dynamic FLV gallery which loads (from an XML file) the paths to some thumbnail jpgs and some itemnames for assembly in a list component. The paths to the FLVs are also loaded from here.
This is working fine, (although needs significant tarting up) but now I would like to add a description box which is also referenced from the XML file. I've tried everything I can think of but I've never been great with it and I just can't figure out where I'm messing it up..
A simplified version of my xml is:
Code:
<xml>
<listitem name="Video Title" url="[URL unfurl="true"]http://www.url.com/FLVs/"[/URL] thumb="1.jpg">
<stream name="1.FLV" start="0" len="-1"/>
</listitem>
<menu>
<listitem name="Video Title"/>
</menu>
<description>
<info="video description"/>
</description>
</xml>
and the code that then loads the XML and assembles the content in the list component is:
Code:
//-------------------------LIST SELECTION CHANGE-----------------------------
//Add an event listener on the list, when it triggers, run the listListener function to repopulate the list
list.addEventListener("change", listListener);
//Function that loads the XML file, parses it, and builds the list of available video clips
var xmllist = new XML(); //setup a variable to hold the XML
xmllist.ignoreWhite = true;
xmllist.load( "video_playlist.xml" ); //load the XML file
//The following gets called when the XML has been loaded
xmllist.onLoad = function( status ) {
if ( !status )
trace( status );
var entries = this.childNodes[0];
var playlists = {};
var nav = [];
var descrip = {};
var infopanel = [];
for ( var i = 0; i < entries.childNodes.length; i++ ) {
var entry = entries.childNodes[i];
if ( entry.nodeName == "listitem" )
//builds array of video clip names
playlists[entry.attributes.name] = entry;
else if ( entry.nodeName == "menu" ) {
//builds array of available videos
for ( var j = 0; j < entry.childNodes.length; j++ )
nav[j] = playlists[entry.childNodes[j].attributes.name];
if ( entry.nodeName == "description" ) {
//builds array of available descriptions
infopanel = descrip[entry.attributes.info] = entry;
}
} //end else if
} //end if
//sends the array of videos to the listbox UI
list.dataProvider = nav;
_root.description.text = infopanel;
} //end xmllist.onload
All I really want to do is load the descriptions from the xml into a dynamic text field on the main stage instance named 'description'..
I've been trying this for ages now and am feeling pretty dumb 'cause I just can't figure it out.
I'd be really grateful if anyone could spare a moment to take a look and see if they can work out where i'm going wrong here.
If it helps, I've uploaded my files to the following:
(open directory containing all files)
(or, one big zip with everything on it for convenience)
Thanks for reading.