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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:05:19+00:00 2026-06-09T09:05:19+00:00

I have a flex application which connects to a database. There are several servers

  • 0

I have a flex application which connects to a database. There are several servers on which the databases run. Currently, I have a textboxes ‘host’ and ‘port’ where user can specify to which database they want to connect. I would like to change it to a ComboBox with a list of hosts. I know how to hardcode it in the application, but I would prefer the application to read an xml (or other) file on startup and populate the ComboBox with its contents (in case the databases IPs change in the future). The XML would look somewhat like that:

<root>
   <host ip="123.123.123.123" port="1234"/>
   <host ip="255.255.255.123" port="2700"/>
   <host ip="18.12.65.123" port="1270"/>
</root>

How do I do that? I would like to host the file on server together with the application.

  • 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-09T09:05:21+00:00Added an answer on June 9, 2026 at 9:05 am

    You should load the file from the server (using the URLLoader class)
    Then you can read the data of the loader.

    For example:

    private var loader:URLLoader;
    private function init():void {
        loader=new URLLoader();
        loader.addEventListener(Event.COMPLETE, dataLoaded);
        loader.dataFormat=URLLoaderDataFormat.TEXT;
        var req:URLRequest=new URLRequest("http://my-server/path/to/file");
        loader.load(req);
    }
    
    private function dataLoaded(e:Event):void {
        loader.removeEventListener(Event.COMPLETE, dataLoaded);
        var data:String=loader.data;
    
        //If the file is a flat text file (with 123.123.123.123:1234 on each line)
        var lines:Array=data.split("\n");
        for each(var line:String in lines) {
            var i:Array=line.split(":");
            trace("ip: " + i[0]);
            trace("\nport: " + i[1]);
        }
    
        //If the file is an xml, do this
        var x:XML=new XML(data);
        for each(var host:XML in x.host) {
            trace("ip: " + host.@ip);
            trace("\nport: " + host.@port);
        }
    }
    

    And yes, you can use relative urls

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

Sidebar

Related Questions

We have a Flex application which has several 'pages' worth of content. Each time
I have flex application consisting of several modules which is configured using maven. I'm
We have a Flex application which doesn't currently use the Flex framework as an
I have a Flex application which manage a database composed by 7 tables. I
I have Flex application requiring to filter users depending on there database groups. Depending
We have a flex application that connects to a proxy server which handles authentication.
I have a Flex 4 application which connects to ASP.NET webservice based on FluorineFx
I have a flex application which is configured with blazeds sever and i am
I have a Flex application in which I draw a rectangle using: <s:Rect height=20
I have a Flex client application. I need a clean up function to run

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.