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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:56:40+00:00 2026-06-08T19:56:40+00:00

I have a text file(txt) in my web server. I will read the file

  • 0

I have a text file(txt) in my web server. I will read the file contents and show it to user. The problem is that it does not show line separations and spaces the right way. Also i will need to activate possible links. For example if there is http://www.google.com then user can just click on the link and default browser opens it.

So far i have this:

var fileContents:String;

            try{

                var myLoader:URLLoader = new URLLoader();
                myLoader.addEventListener(Event.COMPLETE, onFileLoaded);
                myLoader.load(new URLRequest("http://my.website.com/test.txt"));

                function onFileLoaded(e:Event):void
                {
                    fileContents = String(e.currentTarget.data);
                    var alertMessage = fileContents;

I have done this same thing in java, but I am not so familiar with ActionScript.

Java code:

URL url = new URL(getString(R.string.url));

                BufferedReader r = new BufferedReader(new InputStreamReader(
                        url.openStream(), "UTF-8"));
                StringBuilder total = new StringBuilder();
                String line;
                while ((line = r.readLine()) != null) {
                    total.append(line);
                    total.append(System.getProperty("line.separator"));

                }
                str = total.toString();
                r.close();

                return str;

Links in java:

final SpannableString s = new SpannableString(sUrl);
            Linkify.addLinks(s, Linkify.WEB_URLS);
  • 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-08T19:56:41+00:00Added an answer on June 8, 2026 at 7:56 pm

    You might consider using the Text Layout Framework (TLF) from Adobe. You can import the text as HTML and it will create clickable links for any URL’s found in the text. TLF is a bit unwieldy, but very powerful.

    private var myTextFlow:TextFlow = TextConverter.importToFlow(sourceText, TextConverter.TEXT_FIELD_HTML_FORMAT);
    

    If you are using Flex 4, can assign the resulting TextFlow object to one of the text components:

    <s:RichText textFlow="{myTextFlow}" />
    

    In an Actionscript project, you have to do a little more work to use the TextFlow. TLF uses an MVC approach. The TextFlow serves as the model, you can use a Sprite for the view, and a ContainerController as the controller:

    private var container:Sprite = new Sprite();
    addChild(container);
    private var controller:ContainerController = new ContainerController(container, 800,600);
    myTextFlow.flowComposer.addController(controller);
    myTextFlow.flowComposer.updateAllControllers();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text file stored in my sql DB. in that .txt file
I have a text file named num.txt who's only contents is the line 123
I have a .txt file having some text. I want to read this file
I have a file (called print_1012720.txt ) that looks like the text shown below.
I have an ASP.NET web service which will create a text file in a
I have this problem that my .php file is presented as clear text in
I have a text file in the root of my web app http://localhost/foo.txt and
I have the following simple code, that reads contents of a text file into
So I have a text file called maze.txt that looks like this: ############### Sacbifnsdfweovw
I have a text file (txt) containing formatted text (just line breaks, carriage returns

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.