Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 592629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:45:35+00:00 2026-05-13T15:45:35+00:00

I am new to XML and am having a small problem in Flash. I

  • 0

I am new to XML and am having a small problem in Flash. I have a number of buttons. Each of these buttons need to open up a different URL which is in a xml file (I have added only one button for now (banstead), as I wasn´t sure how to add more).

My XML:

<?xml version="1.0" encoding="utf-8"?>
<banstead targ="_self" href="http://www.marca.com"> </banstead>

My AS:

weblinkXML = new XML();
weblinkXML.ignoreWhite = true;
weblinkXML.load("xml/counties.xml");
weblinkXML.onLoad = function (success)
{
  var url = weblinkXML.firstChild.attributes.href;
  banstead.onRelease = function ()
  {
    getURL(weblinkXML.url);
  }
}

For some reason when I test the movie and click on the button it doesn´t open the URL I requested.

Appreciate any help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:45:35+00:00Added an answer on May 13, 2026 at 3:45 pm

    You’ve defined the variable url, but then called a different (undefined) variable weblinkXML.url in your getURL call.

    Try this instead:

    weblinkXML.onLoad = function (success)
    {
      trace("success is "+success);// success should be TRUE
      var url = weblinkXML.firstChild.attributes.href;
      trace("url = "+url);
      banstead.onRelease = function ()
      {
        trace("button pressed with "+url);
        getURL(url);
      }
    }
    

    To add more buttons, you might try changing your XML file to look more like this:

    <?xml version="1.0" encoding="utf-8"?>
    <button buttonName="banstead" targ="_self" href="http://www.marca.com"> </button>
    <button buttonName="chipstead" targ="_self" href="http://www.yahoo.com"> </button>
    <button buttonName="tadworth" targ="_self" href="http://www.google.com"> </button>
    

    Then make a loop which goes through the XML and makes a button for each item it finds:

    weblinkXML = new XML();
    weblinkXML.ignoreWhite = true;
    weblinkXML.load("xml/counties.xml");
    weblinkXML.onLoad = function(success) {
        trace("success = "+success);
        banstead._visible=FALSE;// hide the original button: we're making copies
        for (var i:Number = 0; i< weblinkXML.childNodes.length; i++) {
            var myName:String = weblinkXML.childNodes[i].attributes.buttonName;
            // make sure banstead is a MovieClip, not a button, otherwise duplicateMovieClip won't work!
            var myButton:MovieClip = banstead.duplicateMovieClip(myName, i+1);
            // I've assumed your button has a dynamic text field in it named buttonLabel:
            myButton.buttonLabel.text=myName;
            myButton._y=banstead._y+ i*(banstead._height+5);// position the new button
            myButton.href = weblinkXML.childNodes[i].attributes.href;
            myButton.onRelease = function() {
                getURL(this.href);// note that each button has its own href variable
            };
        }
    };
    

    I have made some assumptions about how your project is set up… but I’ve tested it and it seems to work for me

    Let me know how you get on (and don’t forget to click the big tick mark to accept this answer if it has helped you – thanks).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to XML and am having a problem understanding how to implement a
I have this open-source library that I'm having some trouble fixing a problem... This
I'm creating a new XML File out of a table. The problem is I
still new to XML parsing with the iphone so i have a few questions.
I am new to xml parsing. I have the following xml <myMainList> <mySubList> <edited>true</edited>
I'm new to XML/XSLT and am having an issue trying to change an image
I am having some trouble mixing PHP with XML. I currently have a PHP
I need to send a HTTP request (and get XML response) from Flash that
I am having a small problem, every time i try to change the preferences
I am new to ajax and am having what i think is a small

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.