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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:02:13+00:00 2026-06-14T18:02:13+00:00

I’m trying to make a flash where the text dynamically updates from a text

  • 0

I’m trying to make a flash where the text dynamically updates from a text file every time the .swf file is started.

I’m not the brightest when it comes to this, but I will try and explain what I want to make.

I want to have a .txt file in a certain format. Similar to this

example:

    Team1: Time
    Player1: Dusk
    Player2: Dawn
    Player3: Noon
    Team2: Food
    Player1: Pizza
    Player2: Cheese
    Player3: Bread

And then output the text after each element and output them to a dynamic text object with the same name.

I would have an empty text object named Team1: Where after this script is run it would say “Time” instead of blank.

I’ve tried a few different ways of reading the file, but it’s when it comes to the splitting and sending it to the dynamic text objects I have trouble.

The end result with proper adjusting from flash would look something like this

    Time        vs        Food
    Dusk                  Pizza
    Dawn                  Cheese
    Noon                  Bread

This is the current code of what I have as of right now

    var TextLoader:URLLoader = new URLLoader();
    TextLoader.addEventListener(Event.COMPLETE, onLoaded);
    function onLoaded(e:Event):void {
        var PlayerArray:Array = e.target.data.split(/\n/);
    }
   TextLoader.load(new URLRequest("roster1.txt"));

So the question is really, how do I split this properly with the formatting I use and then set the dynamic text to the text followed by the tag (team1:, player1:, etc)

Any help would be greatly appreciated

  • 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-14T18:02:14+00:00Added an answer on June 14, 2026 at 6:02 pm

    Here is a quick and dirty attempt at splitting the data:

    It assumes the prefix and value will be separated by “: ” and that “Team” is used to determine the start of a team.

    It loops through the array of strings and splits each string along “: “, then checks to see if the prefix contains the string “Team” to determine if it is the start of a new team or is currently a player of the current team.

    //assumes this is the starting state of the data
    var playerArray:Array = new Array();
    playerArray.push("Team1: Time",
    "Player1: Dusk",
    "Player2: Dawn",
    "Player3: Noon",
    "Team2: Food",
    "Player1: Pizza",
    "Player2: Cheese",
    "Player3: Bread");
    
    var teams:Array = new Array();
    var currentTeam:Array = new Array();;
    var prefix:String;
    var value:String;
    for(var counter:int = 0; counter < playerArray.length; counter++){
        prefix = playerArray[counter].substring(0, playerArray[counter].indexOf(": "));
        value =  playerArray[counter].substring(playerArray[counter].indexOf(": ") + ": ".length);
    
        // found a team prefix, this is the start of a new team
        if(prefix.indexOf("Team") != -1){
            teams.push(currentTeam);
            currentTeam = new Array();
            currentTeam.push(value); // add the name of the currentTeam to the array
        } else {
            // else this should be a player, add it to the currentTeam array
            currentTeam.push(value);
        }
    }
    // add the last team
    teams.push(currentTeam);
    // remove the first empty team array just due to the way the loop works
    teams.shift();
    
    trace(teams.length); // traces 2
    trace(teams[0]); // traces the team members of first team
    trace(teams[1]); // traces the team members of next team
    

    The result is an array of team arrays, where each team array’s index 0 is the team name followed by the players.

    From here you should just be able to create the textfields (or use existing ones) and set the text from the arrays.

    Perhaps others can come up with a more efficient method? I also tried to see if it was possible by combining it into a long string and splitting along “Team”, then “Player”, then “: “, to try and separate it out, but it got more messy and possibly error prone if a player’s name contained “Team” or “Player” in it.

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

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to render a haml file in a javascript response like so:
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a reasonable size flat file database of text documents mostly saved in
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has

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.