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

  • Home
  • SEARCH
  • 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 8901537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:22:52+00:00 2026-06-15T01:22:52+00:00

I am still struggling loading in random data from an XML file using Actionscript

  • 0

I am still struggling loading in random data from an XML file using Actionscript 3.0 with no repeat of the previous venue.

Basically when I click a button on stage I want a random venue from my xml to display in dynamic text boxes on stage. My XML is located here http://pastebin.com/0qMMkfCs

It would be better to access the data directly without creating an array!

Surely someone knows how to do this correctly. Thankyou 🙂

  • 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-15T01:22:53+00:00Added an answer on June 15, 2026 at 1:22 am

    OK, this edit will show how to ensure they all come up once randomly:

    private var xmlLoader:URLLoader = new URLLoader();
    private var myLoadedXML:XML;
    private var venues:XMLList;
    
    public function getAnotherRandomVenue():XML{
        if(venues.length() > 0){
            var random:Number = Math.floor(Math.random() * (venues.length()-1));
            var thisRandomVenue:XML = new XML(venues[random]);
            delete venues[random];
            return thisRandomVenue;
        }
        return null;
    }
    
    public function loadItUP():void{
        xmlLoader.addEventListener(Event.COMPLETE, onXMLLoaded);
        xmlLoader.load(new URLRequest("http://path.to.venuesXML.xml"));
    }
    
    private function onXMLLoaded(e:Event):void {
        myLoadedXML = new XML(e.target.data);
        venues = myLoadedXML.venue;
        // you are now ready at this point to start calling getAnotherRandomVenue()
    }
    

    Now calling getAnotherRandomVenue will return you a single Venue XML object. You can now either a) call this method repeatedly until it returns null (all items have been randomly returned) or b) look at venues.length() before you call it.

    EDIT: merged the code to clearly when things get loaded and called.

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

Sidebar

Related Questions

I'm still struggling to Stream a file to the HTTP response in Pylons .
Following on from this question , I am still struggling with the Twitter Bootstrap.
I am still struggling to understand the difference between *p, &p, and p. From
I am still struggling with bitwise operators using Ruby. Getting a value 11100 (28
I'm still struggling difficulties with even simple JOIN queries. From my last question, Simple
I'm still struggling with my simple javascript game. Here is my previous question: Simple
I am still struggling a little with XPath. Current XML <?xml version="1.0" encoding="utf-8" ?>
I come from a C background, so I admit that I'm still struggling with
I'm struggling with Doctrine 2 performce when using HYDRATE_OBJECT . When I switch from
I'm still struggling to find an answer to my question. I want to download

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.