timodel
%Europe/Berlin %960 %2007, 23:02
Beste Flashers,
ik ben bezig met het bouwen van een portfolio. De gegevens voor deze portfolio komen uit een xml file. Aan de linkerkant is een menu te zien met de thumbnail + een stukje korte tekst, aan de rechterkant komt de volledige informatie wanneer er op een thumbnail geklikt wordt.
Ik laad (aan de linkerkant) de thumbnails uit een xml file, en maak eerst via een attachmovie een tekstvak aan waar ik de tekst neer wil zetten die bij de betreffende thumbnail hoort. Deze tekst staat ook in de xml file.
Via geen mogelijkheid kan ik het tekstvak echter aan de xml koppelen, zodat dit tekstvak dynamisch wordt ingevuld.
Wie o wie kan mij helpen???? Ik heb nu echt zo'n beetje alles geprobeert.
De fla + xml + images post ik mee als attachment. Ook zal ik hieronder de .as neerzetten.
var thumb_spacing = 80;
// load variables object to handle loading of text
var description_lv = new LoadVars();
description_lv.onData = function(raw_text){
description_txt.text = raw_text;
}
function GeneratePortfolio(portfolio_xml){
var portfolioPictures = portfolio_xml.firstChild.childNodes;
for (var i = 0; i < portfolioPictures.length; i++){
var currentPicture = portfolioPictures[i];
var currentThumb_mc = menu_mc.createEmptyMovieClip("thumbnail_mc"+i,i);
currentThumb_mc.attachMovie("menu", "menu+i", i+1, {_x:50, _y:0});
currentThumb_mc._y = i * thumb_spacing;
currentThumb_mc.createEmptyMovieClip("thumb_container",0);
currentThumb_mc.thumb_container.loadMovie(currentP icture.attributes.thumb);
currentThumb_mc.title = currentPicture.attributes.title;
currentThumb_mc.image = currentPicture.attributes.image;
currentThumb_mc.description = currentPicture.attributes.description;
// en dan hieronder de regel waar ik maar niet uit kom!!!...
currentThumb_mc.description.content_txt.text = currentPicture.attributes.title;
currentThumb_mc.onRollOver = currentThumb_mc.onDragOver = function(){
info_txt.text = this.title;
}
currentThumb_mc.onRollOut = currentThumb_mc.onDragOut = function(){
info_txt.text = "";
}
currentThumb_mc.onRelease = function(){
image_mc.loadMovie(this.image);
description_lv.load(this.description);
}
}
}
// xml object for xml content (defines sources for selections)
var portfolio_xml = new XML();
portfolio_xml.ignoreWhite = true;
portfolio_xml.onLoad = function(success){
if (success) GeneratePortfolio(this);
else trace("Error loading XML file"); // no success? trace error (wont be seen on web)
}
// load
portfolio_xml.load("portfolio.xml");
greetz!!
ik ben bezig met het bouwen van een portfolio. De gegevens voor deze portfolio komen uit een xml file. Aan de linkerkant is een menu te zien met de thumbnail + een stukje korte tekst, aan de rechterkant komt de volledige informatie wanneer er op een thumbnail geklikt wordt.
Ik laad (aan de linkerkant) de thumbnails uit een xml file, en maak eerst via een attachmovie een tekstvak aan waar ik de tekst neer wil zetten die bij de betreffende thumbnail hoort. Deze tekst staat ook in de xml file.
Via geen mogelijkheid kan ik het tekstvak echter aan de xml koppelen, zodat dit tekstvak dynamisch wordt ingevuld.
Wie o wie kan mij helpen???? Ik heb nu echt zo'n beetje alles geprobeert.
De fla + xml + images post ik mee als attachment. Ook zal ik hieronder de .as neerzetten.
var thumb_spacing = 80;
// load variables object to handle loading of text
var description_lv = new LoadVars();
description_lv.onData = function(raw_text){
description_txt.text = raw_text;
}
function GeneratePortfolio(portfolio_xml){
var portfolioPictures = portfolio_xml.firstChild.childNodes;
for (var i = 0; i < portfolioPictures.length; i++){
var currentPicture = portfolioPictures[i];
var currentThumb_mc = menu_mc.createEmptyMovieClip("thumbnail_mc"+i,i);
currentThumb_mc.attachMovie("menu", "menu+i", i+1, {_x:50, _y:0});
currentThumb_mc._y = i * thumb_spacing;
currentThumb_mc.createEmptyMovieClip("thumb_container",0);
currentThumb_mc.thumb_container.loadMovie(currentP icture.attributes.thumb);
currentThumb_mc.title = currentPicture.attributes.title;
currentThumb_mc.image = currentPicture.attributes.image;
currentThumb_mc.description = currentPicture.attributes.description;
// en dan hieronder de regel waar ik maar niet uit kom!!!...
currentThumb_mc.description.content_txt.text = currentPicture.attributes.title;
currentThumb_mc.onRollOver = currentThumb_mc.onDragOver = function(){
info_txt.text = this.title;
}
currentThumb_mc.onRollOut = currentThumb_mc.onDragOut = function(){
info_txt.text = "";
}
currentThumb_mc.onRelease = function(){
image_mc.loadMovie(this.image);
description_lv.load(this.description);
}
}
}
// xml object for xml content (defines sources for selections)
var portfolio_xml = new XML();
portfolio_xml.ignoreWhite = true;
portfolio_xml.onLoad = function(success){
if (success) GeneratePortfolio(this);
else trace("Error loading XML file"); // no success? trace error (wont be seen on web)
}
// load
portfolio_xml.load("portfolio.xml");
greetz!!