A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: xml link problem

  1. #1
    Junior Member
    Join Date
    Sep 2003
    Posts
    1

    xml link problem

    Hello all!
    I'm having trouble getting a link into my flash movie via xml. I've followed a tutorial from:
    http://www.studiowhiz.com/tutorials/24/

    I've put a trace in so the output windows displays the content of that attribute, which seems to be correct, everything is ok but when I click on the link it just opens the root folder where the movie is kept, not the url????

    Can anybody help? The scripts I used are below:

    The xml can be found in the attatched text file

    The actionscript in the flash movie looks like this:

    function parseXMLdoc() {
    title1 = myXML.firstChild.childNodes[0].childNodes[0].childNodes[0].nodeValue;
    content1 = myXML.firstChild.childNodes[0].childNodes[1].childNodes[0].nodeValue;
    company1 = myXML.firstChild.childNodes[0].childNodes[2].childNodes[0].nodeValue;
    web1 = myXML.firstChild.childNodes[0].childNodes[3].childNodes[0].nodeValue;
    myUrl = myXML.firstChild.childNodes[0].childNodes[3].attributes.url;
    weblink.onRelease = function() {
    getURL(this.myUrl,"_blank");
    }
    trace(myXML.firstChild.childNodes[0].childNodes[3].attributes.url);
    }

    Can anybody figure out what is wrong?

    Cheers,

    Adam

  2. #2
    Member
    Join Date
    Jan 2003
    Location
    Australia, Adelaide (SA)
    Posts
    97
    Hi ahcentral,

    You've captured the URL as follows:
    code:

    myUrl = myXML.firstChild.childNodes[0].childNodes[3].attributes.url;


    But then you try to refer to it as this.myUrl. That's your problem.

    Try the following:
    code:

    myUrl = myXML.firstChild.childNodes[0].childNodes[3].attributes.url;
    trace( 'myUrl=\"' + myUrl + '\"' );
    trace( 'this.myUrl=\"' + this.myUrl + '\"' );


    Hope this helps!
    Tim Walters
    Senior Developer
    XML Evangelist
    "XML isn't a language, it's a way of life!"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center