Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot get url links in Flash/xml file to work 1

Status
Not open for further replies.

ozzie1234

Programmer
Nov 8, 2007
5
0
0
CA
I'm very new to xml and am using it for my portfolio galleries for the first time so I have some confusion.

The xml for my "web" gallery Iis like this:

<image>
<name>WEB FOLIO</name>
<image>frogs.jpg</image>
<url> target=_blank</url>
</image>
<image>
<name>WEB FOLIO</name>
<image>technocrane.jpg</image>
<url> target=_blank</url>
</image>
</gallery>

I've also created an onRelease function on image_holder_mc in my web.swf file as follows:

image_holder_mc.onRelease = function() {
getURL("_blank");
};

I want the jpeg images in my web.swf file to take the user to that url in a new browser window when clicked. The problem is that the gallery images, when clicked, don't go to the url specified in the xml file. How do I get the image_holder_mc to "speak" with the jpeg images in the xml file so that the images go to the proper url when clicked? If you go to click the folio button and then try out the web gallery, you will see the error I'm getting.
 
You first need to clean up your web_list.xml file...
Removing your target=_blank bits and adding url's to those nodes where they are missing, as...

<!-- This XML file is loaded in by the Flash, but needs to
be written out properly in order for the script to read it
-->
<?xml version="1.0" ?>
- <!-- XML doctype, leave untouched
-->
- <gallery>
- <!-- opening tag, similar to HTML synatax
-->
- <image>
<name>WEB FOLIO</name>
<image>frogs.jpg</image>
<url> </image>
- <image>
<name>WEB FOLIO</name>
<image>technocrane.jpg</image>
<url> </image>
...

Next, you need to read in those url's to your pics array...
Now, since I've decompiled your web.swf, this is how I did it in the decompiled .fla. It may appear differently in your own original .fla, but I guess you'll get the idea...

Add, the bolded...

... if (success == true)
{
var _loc3 = this.firstChild;
for (var _loc2 = 0; _loc2 < _loc3.childNodes.length; ++_loc2)
{
pics.push({name: _loc3.childNodes[_loc2].childNodes[0].firstChild.nodeValue, image: _loc3.childNodes[_loc2].childNodes[1].firstChild.nodeValue, url: _loc3.childNodes[_loc2].childNodes[2].firstChild.nodeValue});
...

Finally, change your script on the gallery_mc's button to...

image_holder_mc.onRelease = function ()
{
getURL(_parent.pics[_parent.current_pic].url,"_blank");
};


Should work fine, as it does for me...



Regards. FLASH HELP - OPENED FOR BUSINESS!
TO GET YOUR OWN FREE WEBSITE HOSTING
 
Thank you so much for your incredible assistance! It works beautifully and you made the process so easy. I honestly cannot thank you enough!!!
 
To me, it was far more than valuable. You went way above and beyond my expectations and I am very grateful. I've been struggling with this for a few days because I'm much more designer than I am coder so my gratitude is endless. Thanks again!
 
...I guess I've just proven my point about being a designer over a coder... :):):)

PS. I get it now - and yes, it was valuable in both ways.
 
ozzie12
It is considered courtesy on these forums to award a purple star to a contributor who provides valuable assistance to you.
I am just starting with Flash and I feel oldnewbie's assistance should be encouraged as his history reflects a large amount of assistance has already been provided.

Keith
 
Thanks audiopro. I didn't know the etiquette as this is my first time on this valuable forum. oldnewbie now has a purple star and if I could, I'd give him 100 of them for helping me out with my irritating problem!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top