-
hyperlinks in xml data?
I'm importing some xml data to a site and have a node attribute with an "a href" tag but it seems to stop the flow of the xml data.
Simple html tags can be put in xml data, yes?
Last edited by bytemonster; 10-12-2003 at 12:55 AM.
---------------
bytemonster
-
Somebody? The only way I can seem to import a link from xml to flash is to encode each greater-than, less-than, and quote symbol to the html equivalent. Isn't there a better way to do this? I have a url embedded in a node attribute.
---------------
bytemonster
-
Good question mate!
same as mine!
Im trying to get a link on each seperate image,
that im importing with xml...
each pic would be a different link...
I need to have to links working straight from the xml
so its easily editable for large amounts of info/pics.
Anyone help?
-
c'mon...where are the xml gurus around here?
---------------
bytemonster
-
Senior Member
Sorry, not an XML guru, but I did spend the weekend sailing and riding (road bike), so unfortunately I didn't have much time to answer your XML questions.
Simple html tags should be fine. However they must follow the XML standards, so very old html might have:
PHP Code:
<a href=blahblahblah>Link</a>
Which should be:
PHP Code:
<a href='blahblahblah'>Link</a>
The quotes make it legal xml. Seeing you will probably have more questions about the XML & HTML I have a example of converting XML to HTML that can be displayed in an text box:
http://tupps.com/flash/examples/load.../demoText.html
Thanks
Luke
-
Thanks Tupps,
Where about in melbourne are you from?
Im from sydney!
Anyway,
I understand how the ( a href is meant to be .etc )
But my problem lays with how it fits into my XML...
with out stuffing up how it also loads my images into the flash.
I need to get the images in and scrolling,
and have each image as a link its self,
and the link has to come from the XML.
here is the XML i have used now, and the FLA incase you need to put in some actionscript to create a get URL type thing, for each image.
Thanks heaps mate!
Aden
-
SO basically,
When a pic on the scroller is clicked,
I want it to load the url of a page,
where the pic's link, is determined by code
in the XML doccument, in the same tag as the actual image.
Making sence?
Ive seriously got no idea how to make this happen!
grrrrrr
Thanks heaps tupps.
-
-
i'm looking for a way to do this as well for my web portfolio so when thumbnail pic of a website i've done shows - the user can click on it (or some text) that will link them to that particular site
anyone have a solution?
cheers
alex
-
I'm still not getting an answer to my question.
Let's say my xml doc is:
<?xml version="1.0" standalone="no" ?>
<FILMOGRAPHY>
<FILM
title="<a href='ref/lotr-tt_ref.html' target='_blank'>Dirty Dancing</a>"
client="Artisan"
project="Mixing and Mastering in 5.1, 6.1 and 2.0"
/>
</FILMOGRAPHY>
That doesn't seem to work unless I encode the symbols like this:
title="&lt;a href=&quot;ref/lotr-tt_ref.html&quot; target=&quot;_blank&quot;&gt;Dirty Dancing&lt;/a&gt;"
Also, am I limited to 128 characters in an attribute?
The whole point is, I'm trying to make it more easily updatable for the client, who knows very basic html
Am I going to have to convert the attributes into nodes in order to add links or use more than 128 characters?
Where are the xml gurus on this?
Last edited by bytemonster; 10-16-2003 at 07:29 PM.
---------------
bytemonster
-
Its cool guys!
Some one will help us out soon!
Tupps is a genious, so im sure he will help us out when he gets a chance!!
Or some other good citizen of flash kit!!
thanks,
Aden!
-
It think some how ive got to make each image a link, in which then finds the xml and reads the <a href="dfkjhdfjd"></a>
so when the images is clicked, it loads its appropriate page!
different to every other image's link!
i still cant get anyhitng to work!
if anyone is helping...
View my attatchent a few posts up!
thanks
-
i've also been stuck on this for a while and i'm just really, really frustrated. if xml is so great, why is something like a simple unidirectional link so bloody difficult??
luke, i've looked at your example, looked at the xml doc and the .fla, and i guess that i'm just not advanced enough in xml to make this work.
basically my question is: what do i have to do to my actionscript to make the xml display correctly?
here's a concrete example: i have a series of images that load at runtime. to the right of the images i have descriptions; underneath, i have copyright information and want to be able to link to the photographers' sites. so my xml doc looks like
PHP Code:
<?xml version = "1.0"?>
<Images>
<ImageNode jpegURL="images/misc_01.jpg" copyright="photo © Martin Parr">This is a photo of whatever.</ImageNode>
.
.
.
</Images>
and in my .fla i have
Code:
miscXML = new XML();
miscXML.onLoad = displayImages;
miscXML.load("misc.xml");
miscXML.ignoreWhite = true;
function displayImages(success) {
if (success == true) {
rootNode = miscXML.firstChild;
totalImages = rootNode.childNodes.length;
firstImageNode = rootNode.firstChild;
currentImageNode = firstImageNode;
currentIndex = 1;
updateImage(firstImageNode);
}
}
//you probably don't need to know the following, but i'll include it just in case...
function updateImage(newImageNode) {
imagePath = newImageNode.attributes.jpegURL;
copyright = newImageNode.attributes.copyright;
caption = newImageNode.firstChild.nodeValue;
loadMovie(imagePath, targetClip);
}
next_btn.onRelease = function() {
nextImageNode = currentImageNode.nextSibling;
if (nextImageNode == null) {
break;
} else {
currentIndex++;
updateImage(nextImageNode);
currentImageNode = nextImageNode;
}
};
back_btn.onRelease = function() {
previousImageNode = currentImageNode.previousSibling;
if (previousImageNode == null) {
break;
} else {
currentIndex--;
currentImageNode = previousImageNode;
updateImage(previousImageNode);
}
};
i have tried all sorts of things and can't get anything to work. please, please help!
-
Senior Member
OK, seeing there are so many questions in this thread, I will answer them with individual posts.
For ByteMonster, it is not legal to have XML tags in your attributes. Two options are available, one you have already discovered which is to URL encode all the text.
The other would be to move the attributes into nodes (if you wanted a 'proper' way that XML purists would believe in).
eg:
PHP Code:
<FILM
client="Artisan"
project="Mixing and Mastering in 5.1, 6.1 and 2.0">
<TITLE><a href='ref/lotr-tt_ref.html' target='_blank'>Dirty Dancing</a></TITLE>
</FILM>
Thanks
Luke
-
Senior Member
Bodoni,
With your problem, I am guessing that you are not getting the node you think you are getting as the first node.
As a starting point I would place a trace statement in the updateImage function, tracing the newImageNode
trace(newImageNode)
This should print out the node that you are receiving and you can verify that your input data is correct.
If that is correct I would then check to make sure all your variables read from attributes are being set (trace statements again).
If all of that doesn't work I would need to see your flash file.
Thanks
Luke
-
wow, luke, thanks for responding so quickly and specifically.
it's going to take me a few minutes to digest and then try your suggestions.
a couple of thoughts occur to me: (a) the xml code/actionscript that i posted currently works just fine. (sorry if i wasn't clear.) it does what i want it to do. however it fails to work when i try to insert an anchor tag. part of the problem may have been that, as you can see, i set up "copyright" as an attribute, and then tried to use the link within the attribute. if i read your response to bytemonster correctly, that's not a legal move. but i also tried to use the anchor tag within the imageNode, and that didn't work either.
(b) is there any sort of hard and fast rule that makes sense and that i could read somewhere that would say: "here's how to insert a simple unidirectional link into an xml document" and "here's how to set it up in your .fla so that it will work."
how difficult can this be? well very, i guess.
-
That's what I thought, tupps, but for some reason, I get the FONT tag workng but not the A HREF tag. Also, any info after this line is cut off.
PHP Code:
<FILM>
<TITLE><font color="#0000FF"><a_href="ref/lotr-tt_ref.html"_target="_blank">About Schmidt</a></font></TITLE>
<CLIENT>New Line Cinema</CLIENT>
<PROJECT>Mixing and Mastering in 5.1 & 2.0</PROJECT>
</FILM>
<FILM>
Am I doing something wrong? Do I have to add something to my code?
---------------
bytemonster
-
Senior Member
ByteMonster:
Is there any reason that there is an underscore in your < a href tag? Also in front of target as well?
Thanks
Luke
-
Senior Member
Bodoni
For hard and fast rules:
1) Anything in attributes must be either straight text, or you could urlencode the text and use that. Flash has a escape and a unescape function that will handle urlencoded text.
2) In a node there are two ways to add HTML. One is to use a CDATA tag, which the XML parser will basically ignore and give you in its entirity. Otherwise you have to make sure that everything is valid XML.
Thanks
Luke
-
thanks tupps...that was a screwup...it's working now...except for that pesky 128 character problem.
---------------
bytemonster
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|