PDA

Volledige versie bekijken : xml fotogallerij > link toevoegen aan onderschrift


KsChoice
%Europe/Berlin %380 %2007, 09:08
Kan iemand me helpen bij hetvolgende.

Ik heb op vraag van een kennis een fotogallerij (flash + xml) ineengeknutseld.
Die kennis zou er graag nog een extra functie aan toegevoegd willen zien > de mogelijkheid tot het maken van hyperlinks in de onderschriften (caption in de xml-file).
Ik weet niet zo meteen hoe ik dit moet aanpakken / oplossen ...

mijn xml-file :


<images>
<pic>
<image>album_1/foto/foto_01.jpg</image>
<caption>Hier komt onderschriftje nummer 1</caption>
<thumbnail>album_1/thumbs/thumb_01.jpg</thumbnail>
</pic>

<pic>
<image>album_1/foto/foto_02.jpg</image>
<caption>Hier komt onderschriftje nummer 2</caption>
<thumbnail>album_1/thumbs/thumb_02.jpg</thumbnail>
</pic>


kan het op een of andere manier iets worden alla :
<caption>Hier komt <a href="www.hierdelink.be"> onderschriftje </a> nummer 2</caption>
of los ik het (beter) op een andere manier op > door bijvoorbeeld elk onderschriftje in een afzonderlijk .txt-bestandje te steken en in de xml naar dit bestandje te verwijzen ???

mijn actionscript


function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
thumbnails = [];
total = xmlNode.childNodes.length;
totaal = total;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
linkto[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
thumbnails_fn(i);
}
firstImage();
if (current_pos == 1){previous_btn._visible=false};
if (current_pos > 1){previous_btn._visible=true};
if (current_pos == totaal){next_btn._visible=false};
if (current_pos < totaal){next_btn._visible=true};
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(_global.url);
/////////////////////////////////////
Key.addListener(listen);
previous_btn.onPress = function() {
prevImage();
if (current_pos == 1){previous_btn._visible=false ; box_1._visible=false };
if (current_pos > 1){previous_btn._visible=true};
if (current_pos == totaal){next_btn._visible=false ; box_2._visible=false };
if (current_pos < totaal){next_btn._visible=true};
};
next_btn.onPress = function() {
nextImage();
if (current_pos == 1){previous_btn._visible=false ; box_1._visible=false };
if (current_pos > 1){previous_btn._visible=true};
if (current_pos == totaal){next_btn._visible=false ; box_2._visible=false };
if (current_pos < totaal){next_btn._visible=true};
};



/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
total = Math.floor((loaded / filesize)*100);
preloader._visible = true;
if (loaded != filesize) {
preloader._visible = true;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
if (p<(totaal-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
onderschrift.desc_txt.text = description[0];/////
picture_num();
nummering.pos_txt.text = 1+" / "+totaal;
p=0;
}
}
function picture_num() {
current_pos = p+1;
nummering.pos_txt.text = current_pos+" / "+totaal;
trace(current_pos)
}
function thumbNailScroller() {
this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 10;
tscroller.onEnterFrame = function() {
if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
if ((_root._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right))) {
thumbnail_mc._x -= scroll_speed;
} else if ((_root._xmouse<=(hit_left._x+40)) && (thumbnail_mc.hitTest(hit_left))) {
thumbnail_mc._x += scroll_speed;
}
} else {
delete tscroller.onEnterFrame;
}
};
}
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = hit_left._x+(target_mc._width+5)*k;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
if (current_pos == 1){previous_btn._visible=false ; box_1._visible=false };
if (current_pos > 1){previous_btn._visible=true};
if (current_pos == totaal){next_btn._visible=false ; box_2._visible=false };
if (current_pos < totaal){next_btn._visible=true};
};
target_mc.onRollOver = function() {
this._alpha = 50;
thumbNailScroller();
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}

r0cker20
%Europe/Berlin %439 %2007, 10:33
bij ( target_mc.onRelease = function(){ ) het volgende toevoegen:


var link_mc:MovieClip = _parent.createEmptyMovieClip("link", _parent.getNextHighestDepth());
link_mc.onRelease = function(){
scope.gotoURL(this.linkto[index]);
}


Als je nog vragen hebt hoor ik het wel!

BernardV
%Europe/Berlin %453 %2007, 10:52
De manier die je wilt gebruiken met HTML tekst wil prima, alleen dan zul je de tekst wel in een CDATA blok moeten plaatsen, anders wordt <a></a> als node gezien.

Iets meer info over CDATA: http://www.w3schools.com/xml/xml_cdata.asp