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 7986889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:58:58+00:00 2026-06-04T11:58:58+00:00

I am quite new to dealing with xml files through Flash and Action Script

  • 0

I am quite new to dealing with xml files through Flash and Action Script 3.0.
I write this piece of code with the intention of changing all the QUESTION children into WRONG.

var urlRequest:URLRequest = new URLRequest("question.xml");
        var urlLoader:URLLoader = new URLLoader();
        urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
        urlLoader.addEventListener(Event.COMPLETE, urlLoader_complete, false, 0, true);
        urlLoader.load(urlRequest);


    private function urlLoader_complete(e:Event):void {
        var question:XML = new XML(e.target.data);
        question.QUESTION.setName("WRONG");
        trace("FINISH!");
    }

The program runs and I successfully got the word Finish traced. However when I check the xml file question.xml, not one of the QUESTION children is renamed.

Can someone explain this for me?

Thanks a lot

  • 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-06-04T11:58:59+00:00Added an answer on June 4, 2026 at 11:58 am

    setName is the correct method, but in your example, you are not using it on the individual nodes, but on the XMLList that is returned by question.QUESTION – which, technically, does not appear in the XML tree, and therefore does not reflect the change within the XML output.

    You need to iterate over the actual nodes to get a result:

    var question:XML = <QUESTIONS><QUESTION /><QUESTION /></QUESTIONS>;
    var questions:XMLList = question.QUESTION;
    for each( var node:XML in questions )
        node.setName( "WRONG" );
    trace ( question ); // output: <QUESTIONS><WRONG /><WRONG /></QUESTIONS>
    

    Or for a single node:

    var question:XML = <QUESTIONS><QUESTION /></QUESTIONS>;
    var questions:XMLList = question.QUESTION;
    questions[0].setName( "WRONG" );
    trace ( question ); // output: <QUESTIONS><WRONG /></QUESTIONS>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Quite new to this but i have created a SQL script that groups by
I am currently dealing with log files with sizes approx. 5gb. I'm quite new
I'm quite new to this (understanding the WP Guts), and I wanted to understand
Quite new to functional languages, but I'm maintaining someone else's code with a lot
Quite new to this mocking thing, I have a couple of questions. Correct me
Quite new to xslt so forgive me if this is a basic question -
im quite new to android, so i apologise if this is a noob-ish question
I'm dealing with an issue that's driving me crazy. I'm quite new in programming
I found Nokogiri is quite powerful on dealing with xml but I met a
Quite new to maven here so let me explain first what I am trying

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.