Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 06:47
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Server side Scripting and Database Support
| |-+  Web Services: XML, Soap, WSDL, UDDI, and Flash Integration (Moderators: Flash-db, Musicman, vesa kortelainen, Ronald Wernecke, Jorge Solis)
| | |-+  Add a XML link to a flash button
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Add a XML link to a flash button  (Read 5449 times)
Bruceleeroy
Server what's that
*
Posts: 2


View Profile
« on: 04/07/09, 13:17 »

Hey guys,
I just had a quick question.

I am using a XML photo gallery from Kirupa that looks like this:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
    <pic>
        <image>http://www.kirupa.com/developer/mx2004/pg/kresge.jpg</image>
        <caption>Kresge</caption>
    </pic>
</images>

I have a button on the movie clip that says VISIT WEBSITE and has a rollon and off state.
I want to be able to change the a href for that button but I cant think of how to do it.

How can I make it reference the XML file?

Any help would be greatly appreciated.
Thanks
Logged
Bruceleeroy
Server what's that
*
Posts: 2


View Profile
« Reply #1 on: 04/07/09, 14:06 »

In my Actionscript I added this for the button:

Code:
on (rollOver) {
gotoAndPlay("over");

}

on (rollOut) {
gotoAndPlay("out");

}

on (release) {     
getURL(_root.linkbtn, "_self");
}

Then I updated the XML to be this:
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
    <pic>
        <image>http://www.kirupa.com/developer/mx2004/pg/kresge.jpg</image>
        <caption>Kresge</caption>
<link>http://www.kirupa.com/developer/mx2004/pg/kresge.jpg</link>
    </pic>
   </images>

And finally the actionscript that calls the XML looks like this:

Code:
stop();
function loadXML(loaded) {

if (loaded) {

xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {

image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
link[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;

link.text = _root.linkbtn;

I am probably missing something really basic.

Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #2 on: 04/08/09, 00:16 »

getURL is the command to read a link.
Whatever you give to this call, you will load into the current window
Logged

happy flashing
Cool
Ronald
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!