Hey everybody,
Basically I am trying to create a “page” in a flash program that loads a list of bands and some other info via an XML import. It displays a thumb for each band, on mouseover it displays the band name beneath the thumb and onrelease it calls the bands website. I read through Kirupa’s “introduction to HTML in flash” to get my basics. The tutorial I was learning from has a “static” MC that the Thumbs are loaded into. In my case however I have a large # of items and limited real estate, so I wanted to place them in a scrollpane. I believe that the way I am trying to get the content into the pane is where I am screwing up. I am hoping some of you can help me get on the right track.
So to start this off I will post my code:
var item_count = 0;
var description_lv = new LoadVars();
description_lv.onData = function(raw_text){
description_lv.text = raw_text;
}
function createList(band_xml) {
scroller.setScrollContent("contentHolder");
var scrollContent = scroller.getScrollContent();
var columns = 5;
var xDist = 90;
var yDist = 90;
var columnNum = 0;
var rowNum = 0;
var items = band_xml.firstChild.childNodes;
for (var i=0; i<items.length; i++) {
var currentObject = items*;
var currentThumb_mc = scrollContent.attachMovie("object","thumbnail"+item_count, item_count);
currentThumb_mc._x = columnNum * xDist;
currentThumb_mc._y = rowNum * yDist;
if (columnNum>columns-1) {
columnNum = 0;
rowNum++;
}
currentThumb_mc.createEmptyMovieClip("pic_container", 0);
currentThumb_mc.pic_container.loadMovie(currentObject.attributes.pic);
currentThumb_mc.Artist = currentObject.attributes.Artist;
currentThumb_mc.link = currentObject.attributes.link;
currentThumb_mc.onRollOver = currentThumb_mc.onDragOver = function(){
name_txt.text = this.Artist;
}
currentThumb_mc.onRollOut = currentThumb.onDragOut = function(){
name_txt.text = "";
}
currentThumb_mc.onRelease = function(){
getURL(this.link, _blank);
}
columnNum++;
}
scroller.refreshPane();
}
contentHolder_mc is an empty clip
object_mc is empty except for the “name_txt” box
(The actual loading of the XML file and the onLoad running of the “createList” function is on the second frame by the way, in case you wondered)
The tutorial I referred to for using a scrollpane was using mc’s that were already in the SWf and not dynamically loaded. and its AS is as follows:
function loadScrollableContent() {
scroller.setScrollContent("contentHolder");
var scrollContent = scroller.getScrollContent();
var columns = 5;
var xSpace = 100;
var ySpace = 100;
var columnNum = 0;
var rowNum = 0;
for (x=0; x<10; x++) {
layer++;
scrollContent.attachMovie("myMovie", "myMovie", layer);
scrollContent.myMovie.duplicateMovieClip("myMovie"+x, layer);
if (columnNum>columns-1) {
columnNum = 0;
rowNum++;
}
//use embeded fonts
scrollContent["myMovie"+x].text = "Mr. Phil "+x;
scrollContent["myMovie"+x]._x = -270.5+(columnNum*xSpace);
scrollContent["myMovie"+x]._y = -127.8+(rowNum*ySpace);
columnNum++;
}
scroller.refreshPane();
}
SOooo… I was thinking that what I needed to was create the thumb and then after constructing the currentThumb_mc THEN I should load it into the pane rather than try to include the getcontent call into the currentThumb var. But my brain is fried. So your thoughts on this are appreciated.