-
hyperlinks in XML...?
i'm trying to add some hyperlinks to the text within the msg tags; please can someone tell me how to do this.... (with the link opening in a new browser window):
PHP Code:
<?xml version="1.0"?>
<diary>
<cal yearID="2006" monthID="0">
<date id="1">
<msg>an event</msg>
</date>
<date id="17">
<msg>another event</msg>
</date>
</cal>
</diary>
cheers.
-
this is where i'm up to now:
PHP Code:
<?xml version="1.0"?>
<diary xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple">
<cal yearID="2006" monthID="1">
<date id="1">
<msg>an event</msg>
</date>
<date id="10">
<msg>another big event</msg>
</date>
<date id="12">
<msg>event</msg>
</date>
<date id="25">
<msg>another event</msg>
</date>
</cal>
<cal yearID="2006" monthID="0">
<date id="27">
<msg>new event..... <a xlink:type="simple" href="www.google.co.uk"> ...link... </a> </msg>
</date>
<date id="28">
<msg>this is going to be a really funky event</msg>
</date>
</cal>
</diary>
...but this still doesn't work...
-
Senior Member
-
thanks Luke
but what i don't get is that there is no code at all in the XML file?? all the code is in the Flash file?
....but what i also don't understand is what is identifying the word "link" to be a link, and where's the http address etc ??
-
<msg><![CDATA[Welcome to <a href='www.yahoo.com'>YAHOO</a>Cheers]]></msg>
Populate this as htmlText in a Flash dynamic textfield with html set to true[/QUOTE]
-
... atrangee... superb!! thanks
at first i still had some of my old message straight after the <msg> tags, and it didn't work, nothing appeared... when i inserted the code exactly as you've written it above... works a treat! and i've noticed i can add further HTML tags to underline the links etc... i owe you a pint!!
-
So what did you end up using to make this all work out...
I use the CDATA solution and It does not work... are you using Luke's solution in conjunction ?
Oh ya... I am using flash 8 too if that makes any difference.
Adam
-
I got it working.. as a side not, since I have been working on this all day and the solution made me feel like an idiot.. In the AS when you are setting the text. You need to be sure you pass the nodeValue... I was doing this:
myTxt.txt = xmlNode.firstChild
That was wrong.. It was rendering the text, but it would not do the link... then I did this:
myTxt = xmlNode.firstChild.nodeValue
and that did the trick.
-
hi logix
sorry i didn't reply... my email notifications don't work, so i have to manually check my subscriptions (i've informed the moderators but no response as yet)...
but glad to hear you got it working!!
-
If anyone could help me out, please. I don't understand how to make links in a xml. And I've read through a lot of post and some of the links here. Most of them used an older flash player and thus didn't work with mine. So far it has been quite easy to work in xml and Flash but I'm completely lost in thi case. Here's my code for my xml file. I use flashplayer 7 and as 2.0:
Code:
stop();
container.stop();
var timeline = this;
System.useCodepage = true;
var loader2:XML = new XML();
loader2.load("files/Filer/Flash/overskrift.xml");
loader2.ignoreWhite = true;
loader2.onLoad = function() {
_global.rod2 = this.firstChild.childNodes;
var antalXML:Number = rod2.length-1;
setter(0);
};
setter = function (id) {
timeline.container_overskrift.overskrift.text = rod2[id].firstChild.firstChild.nodeValue;
timeline.container_overskrift.overskrift.autoSize = true;
timeline.container_overskrift.overskrift.multiline = true;
};
function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.floor(Math.random()*(max-min+1))+min;
return randomNum;
}
var loader:XML = new XML();
loader.load("files/Filer/Flash/tekst.xml");
loader.ignoreWhite = true;
loader.onLoad = function() {
_global.rod = this.firstChild.childNodes;
var antalXML:Number = rod.length-1;
for (i=0; i<1; i++) {
var randomNumber:Number = randRange(0, antalXML);
}
setter2(randomNumber);
};
setter2 = function (id) {
timeline.container.holder.tekst1.text = rod[id].firstChild.firstChild.nodeValue;
timeline.container.holder.tekst1.multiline = true;
timeline.container.holder.tekst2.text = rod[id].firstChild.nextSibling.firstChild;
timeline.container.holder.tekst2.multiline = true;
container.play();
_global.antal = id;
};
Regards
Michael
-
hi fahlsten... i don't know too much about XML; this is the first time i've used it... but i found atrangees solution worked for me (using the ![CDATA[ code in the XML file itself), i didn't need to touch the Flash AS.
you may need to render the dynamic text in the Flash movie as HTML, i'm not sure...
ric
-
Hello Ric and thanks for your reply. How do I use tha CDATA? I tried but I must have done something wrong.
Regards
michael
-
try this:
<msg><![CDATA[blah blah blah text, and now take a look at this <u><a href='http://www.domain.co.uk' target='_blank'>website</a></u> this week]]>
</msg>
-
Hello again. When I try that, the output is:
blah blah blah text, and now take a look at this <u><a href='http://www.domain.co.uk' target='_blank'>website</a></u> this week
The same happened when I tried before. My textfield renders text as HTML and in my code I use:
textfield.html = true;
What am I doing wrong??
Regards
Michael
-
sorry mate! i'm not very good at this stuff!! it's the first time i've used it and luckily it worked for me... hopefully one of the others in this thread will help... or anyone else who reads this..... good luck
-
Ok, thanks for trying .
Hopefully someone will explain it. It's probably just something simple I didn't put in the code.
-
Now it's working!
Finally
-
Fahlsten, how did you get this to work? I'm struggling with hyperlinking XML into flash. I've tried everything from CADTA to XLink and I feel I'm probably doin something very wrong.
-
Hello tcheese.
I'll just have a look into it later today and explain how I did it. I'll also send a fla, so you'll see how it's working
-
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
|