Hey All,
First let me start by saying I am new to the list component. What I am trying to do is to use a List component in Flash to create a "menu" that is driven by XML data. I want to use the menu to load image files into a blank instance and then have that instance look to see if there are more than one nodes available for an image. If there is more than one then have it display thumbnails of each extra node. I have an idea on how to load the thumbnails, but not real sure on how to get the empty instance to know if there are more nodes referring to an image. Currently I have a list component on the screen, an empty movie clip, and this is what I have so far code (I know, I know pretty basic):
Flash -
import mx.utils.Delegate;
import mx.controls.List;
//************************
**********
//
var listData:Array = new Array();
var myList_xml:XML;
var myList_ls:List;
//************************
**********
//
_global.style.setStyle("co
lor", 0x333333);
_global.style.setStyle("th
emeColor",
"0xBB6E7F");
_global.style.setStyle("fo
ntSize", 12);
_global.style.setStyle("fo
ntFamily",
"Verdana");
_global.style.setStyle("em
bedFonts",
"false");
myList_ls.rowHeight = 16;
myList_ls.rowCount = 20;
songList_ln.selectable = false;
myList_ls.multipleSelectio
n = false;
myList_ls.setStyle("altern
atingRowCo
lors", [0xFFFFFF, 0xDDDDFF]);
//************************
**********
//
myList_ls.addEventListener
("change",
Delegate.create(this, doPlay));
//************************
**********
//
function doPlay(eventSrc:Object):Vo
id {
_root.dZ.loadMovie(eventSr
c.target.s
electedIte
m.data, true);
}
//************************
**********
//
myList_xml = new XML();
myList_xml.ignoreWhite = true;
myList_xml.onLoad = Delegate.create(this, myListLoaded);
//************************
**********
//
function myListLoaded():Void {
var mainNode:XMLNode = this.myList_xml.firstChild
;
this.myList_ls.dataProvide
r = listData;
var resourceCount:Number = mainNode.childNodes.length
;
for (var i = 0; i<resourceCount; i++) {
listData.addItem({label:i+
1+". "+mainNode.childNodes[i].a
ttributes.
title, data:mainNode.childNodes[i
].attribut
es.url});
}
//myList_ls.selectedIndex = i;
myList_ls.dispatchEvent({t
ype:"chang
e", target:myList_ls});
}
myList_xml.load("helpXML/s
timForms.x
ml");
In XML -
<?xml version="1.0" encoding="UTF-8"?>
<list>
<item url="StimProcessMaps/test/
DEC07_PM-G
L-HAL-STIM
-100_Page_
1.png", subItem title="Stim 100"/>
</list>
I think the XML should look something like this:
<?xml version="1.0" encoding="UTF-8"?>
<list>
<Item title="Stim 100"
<subItem url=myImages/myImageFile1.
png" />
<subItem url=myImages/myImageFile2.
png" />
<subItem url=myImages/myImageFile3.
png" />
</item>
</list>
Any information will be greatly appreciated.
-Frankie
Start Free Trial