FORUMS: list search recent posts

Updating XML attributes based on listbox selection

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Zack Yoshyaro
Updating XML attributes based on listbox selection
on Mar 24, 2010 at 3:37:36 pm

I'm using the code from gotoandLearn to read from an XML file and generate listBox items which, when clicked, load an external flv.



var vlist:XML = new XML();
vlist.ignoreWhite = true;


vlist.onLoad = function() {
var videos:Array = this.firstChild.childNodes;
for(i=0;i videoList.addItem(videos[i].attributes.desc,videos[i].attributes.url);

}


//ns.play(videoList.getItemAt(0).data);
videoList.selectedIndex = 0;

}

var vidList:Object = new Object();

vidList.change = function() {
ns.play(videoList.getItemAt(videoList.selectedInde x).data);
}

videoList.addEventListener("change",vidList);

vlist.load("videos.xml");



What I'm trying to do is read another attribute field from the XML and display it in a separate text box on the stage. For instance, a "speaker" attribute.

So I add:


var speakers:Array = new Array();


And stick this in the for loop:


speakers.addItem(videos[i].attributes.Speaker);



Now, I can manually read and display the XML "Speaker" attribute in my textbox by specifying the Array number [0], or [1], etc... But I'm unsure how to make it update based on what is selected in the listBox.




Return to posts index

Zack Yoshyaro
Re: Updating XML attributes based on listbox selection
on Mar 24, 2010 at 3:39:11 pm

(This is in flash 8 by the way)

The other thing I forgot:

I also need to track another XML attribute so it updates based on my listbox selection. It's for a corresponding PDF files. The address of the PDF would need to be 'loaded' into the button each time the user selects something new in the list box.

This is for a projector file.. if that makes any difference.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]