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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:56:49+00:00 2026-05-26T15:56:49+00:00

I’m building a Facebook client in actionscript, and I’m running into a problem. I

  • 0

I’m building a Facebook client in actionscript, and I’m running into a problem. I have this block of code:

        var loader:URLLoader = URLLoader(event.target);

        var feedResponse:String = (event.target.data);
        var object:Object = JSON.decode(feedResponse); //getting the data

        var friendsStatus:Array = new Array(); //array for status'
        var friendsName:Array = new Array(); //array for names

        var startX:int = 120;
        var startY:int = 100;

        var myFormat:TextFormat = new TextFormat();
        myFormat.size = 16;

        var statusMessage:TextField = new TextField();
        statusMessage.defaultTextFormat = myFormat;
        statusMessage.wordWrap = true;
        statusMessage.width = 600;

        var faceFriend:TextField = new TextField();
        faceFriend.defaultTextFormat = myFormat;
        faceFriend.wordWrap = true;
        faceFriend.width = 300;

        for(var i:int = 0; i < 10; i++)
        {
            if(object.data[i].message == undefined){
                var userStory:String = object.data[i].story; // mowing through the facebook JSON response
                friendsStatus[i] = userStory;
            } else {
                var userStatus:String = object.data[i].message;
                friendsStatus[i] = userStatus;
            }

            var fName:String = object.data[i].from.name;
            friendsName[i] = fName;
        } 

        for(var j:int; j < 10; j++) // The headache loop
        {
            faceFriend.x = startX;
            faceFriend.y = startY;

            faceFriend.text = friendsName[j]; //assign the current name to the TextField text property
            addChild(faceFriend); //add it to the stage
            startY += 30; //increase the y value so they dont overlap
            trace(startY);
            trace(faceFriend.text);
            trace("");

            statusMessage.x = startX;
            statusMessage.y = startY;

            statusMessage.text = friendsStatus[j]; //same here for the status'
            addChild(statusMessage);
            startY += 20;
            trace(startY);
            trace(statusMessage.text);
            trace("");
        }

which is supposed to loop through a set of status’, assign them to variables and add them to the stage. However, all I achieve is the very last status being added to the stage.
As you can see from all the traces, I have discovered that all the arrays have the correct information, and the y value (so its not all on top of each other) is progressing correctly. It just refuses to let anything but the final TextField be visible 🙁

Any ideas?

P.S. I realise it’s not exactly brilliant code – sorry for the headache in advance 😛

  • 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-05-26T15:56:49+00:00Added an answer on May 26, 2026 at 3:56 pm

    You need to create

    var faceFriend:textField inside the loop.
    

    What you are currently doing is creating one text field and manipulating it over and over again. Which is causing a problem. This code will generate 10 fields and align them horizontally.

    var faceFriend:TextField;
    
    for(var i:uint;i<10;i++)
    {
        faceFriend = new TextField();
        faceFriend.x = i*20;
        addChild(faceFriend);
    }
    

    whereas this code will generate one field manipulate it 10 times and show you one field , which is essentially what you are doing.

    var facefriend:TextField = new TextField();
    
     for(var i:uint;i<10;i++)
     {
        faceFriend.x = i*20;
        addChild(faceFriend);
     }
    

    This

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

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I have some data like this: 1 2 3 4 5 9 2 6
I have just tried to save a simple *.rtf file with some websites and

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.