|
-
XML hyperlink | Flash
I've figured out how to hyperlink XML when the XML doc only has one node. Unfortunately, my XML has much more and after a lot of research, all the solutions seem complicated and involve XLink or XSL, which I know nothing about. Is there an easy solution to hyperlinking an XML document, as well as the corresponding Flash actionscripting? Here's the basic breakdown of my XML:
<country>
<office>
<city>(city)</city>
<address>(address)</address>
<contact>(contact #)</contact>
<email>[email protected]</email>
</office>
I need to hyperlink the email address. And my actionscripting:
function loadXML(loaded) {
if (loaded) {
_root.office = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.address = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
_root.contact = this.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
_root.email = this.firstChild.childNodes[0].childNodes[3].firstChild.nodeValue;
_root.city_txt.text = _root.office;
_root.address_txt.text = _root.address;
_root.contact_txt.text = _root.contact;
_root.email_txt.text = _root.email;
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("locations.xml");
}
Thanks for any help! The dynamic text box is on the root timeline and given instant name "email_txt."
-
change <email>[email protected]</email> to <email>mailto:[email protected]</email>
then for the button
on (release) {
getURL(_root.email);
}
make sure you have Expression checked or it wont' work.
-
 Originally Posted by davedebus
change <email> [email protected]</email> to <email>mailto: [email protected]</email>
then for the button
on (release) {
getURL(_root.email);
}
make sure you have Expression checked or it wont' work.
I believe the button should be:
on (release) {
getURL(_root.email.text);
}
-
FK'n_dog
getURL(_root.email.text);
// misd -- this textfield doesn't exist 
it's _root.email_txt.text which is the same as the variable _root.email
you could shorten the script to -
aNode = this.firstChild.childNodes[0];
_root.email_txt.text = _root.email = aNode.childNodes[3].firstChild.nodeValue;
fwiw - mailto is dependant on OS/email settings, so is unreliable
use a server side mailing script and LoadVars.sendAndLoad in Flash
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
|