Skip to main content
melas076
Known Participant
May 16, 2011
Question

PDF LINKS NOT WORKING !!!!!

  • May 16, 2011
  • 2 replies
  • 3265 views

Dear all,

I tried several time to load a pdf file and clickable for each sublinks.

this is the code in my root:

var newsXML:XML = new XML();
newsXML.ignoreWhite = true;
var output:String = "";

newsXML.onLoad = function(success) {
    if (success) {
    for(var i:Number=0;i<newsXML.childNodes[1].childNodes.length;i++){
var tlink:String = newsXML.childNodes[1].attributes.Name;
var linkS:String = newsXML.childNodes[1].childNodes.attributes.name;
var textS:String = newsXML.childNodes[1].childNodes.firstChild.nodeValue;
var pdfS:String = newsXML.childNodes[1].childNodes.attributes.pdfurls;
var urlpdf = pdfS;
_root.sub_bg.subTXT1.htmlText += "<a href='asfunction:linkF,"+textS+"'>"+linkS+"</a><br>";
_root.sub_bg.linktitle.htmlText = tlink;

_root.bg.butpdf.onRelease = function() {
getURL(urlpdf,"_blank");
    };

What i missed?

i appreciate your help!

MELAS

This topic has been closed for replies.

2 replies

kglad
Community Expert
Community Expert
May 22, 2011

great.  so, if your buttons are _root.bg.butpdf0, _root.bg.butpdf1,...

use:


this is the code in my root:

var newsXML:XML = new XML();
newsXML.ignoreWhite = true;
var output:String = "";

newsXML.onLoad = function(success) {
    if (success) {
    for(var i:Number=0;i<newsXML.childNodes[1].childNodes.length;i++){
var tlink:String = newsXML.childNodes[1].attributes.Name;
var linkS:String = newsXML.childNodes[1].childNodes.attributes.name;
var textS:String = newsXML.childNodes[1].childNodes.firstChild.nodeValue;
var pdfS:String = newsXML.childNodes[1].childNodes.attributes.pdfurls;

_root.sub_bg.subTXT1.htmlText += "<a href='asfunction:linkF,"+textS+"'>"+linkS+"</a><br>";
_root.sub_bg.linktitle.htmlText = tlink;

_root.bg["butpdf"+i].urlpdf = pdfS;

_root.bg["butpdf"+i].onRelease = function() {
getURL(this.urlpdf,"_blank");
    };

}

}


melas076
melas076Author
Known Participant
May 23, 2011

it is only _root.bg.butpdf0.

how can i do it?

Regards,

MELAS

kglad
Community Expert
Community Expert
May 24, 2011

rename all your movieclip buttons so they match _root.bg.butpdf0,_root.bgbutpdf1,...

kglad
Community Expert
Community Expert
May 16, 2011

1.  test online or fix your security settings.

2.  use the trace() function to make sure your variables are what you think they should be.

melas076
melas076Author
Known Participant
May 16, 2011

i did a trace(); but it gives me this: 1.pdf, 2.pdf, 3.pdf, 4.pdf..............

and i want for each sublinks have each pdf and text......

i appreciate your help.

MELAS

kglad
Community Expert
Community Expert
May 16, 2011

what about 1?

2.  are those the names of your pdfs?