A Flash Developer Resource Site

Results 1 to 20 of 35

Thread: How to control a buttons link using xml

Threaded View

  1. #4
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    you would just use the value in that particular node as the value of the VAR in the getURL method.

    example:

    Code:
    button1.onPress = function() {
        getURL(xmlDocument.childNode[0].firstChild.nodeValue);
    }
    or wherever the node really is.

    heres a quick example: (although Im not sure HOW your link is going to be set up..here I just used a textField to not only DISPLAY the value of the NODE.but use that value AS the URL to go to:

    example:
    Code:
    var myXML:XML = new XML("<Details><Username>(ip) R o l i e (ip) ~ (#)</Username><PSM>http://www.nike.com</PSM><Status>Online</Status></Details>");
    
    trace("WHOLE XML: "+myXML);
    /////
    trace(newline);
    ////
    //username node
    trace("Full User Node: "+myXML.firstChild.childNodes[0]);
    trace("User Node Name: "+myXML.firstChild.childNodes[0].nodeName);
    trace("User Value: "+myXML.firstChild.childNodes[0].firstChild.nodeValue);
    /////
    trace(newline);
    ////
    //psm node
    trace("Full PSM Node: "+myXML.firstChild.childNodes[1]);
    trace("PSM Node Name: "+myXML.firstChild.childNodes[1].nodeName);
    trace("PSM Value: "+myXML.firstChild.childNodes[1].firstChild.nodeValue);
    linkField_txt.text = myXML.firstChild.childNodes[1].firstChild.nodeValue;
    var myformat:TextFormat = new TextFormat();
    myformat.url = myXML.firstChild.childNodes[1].firstChild.nodeValue;
    linkField_txt.setTextFormat(myformat);

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