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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:49:33+00:00 2026-05-28T02:49:33+00:00

I used var dp:ArrayCollection = new ArrayCollection(container.GetVotesResult); to get the JSON data from GetVotesResult

  • 0

I used var dp:ArrayCollection = new ArrayCollection(container.GetVotesResult); to get the JSON data from GetVotesResult method. I get the values as below.

{"GetVotesResult":
[{"Aid":0,"Arank":0,"Atext":null,"ClientId":16,"Votes":0,"qid":10,"qtext":"Who will win 2011 football world cup?"},
{"Aid":4,"Arank":1,"Atext":"yes","ClientId":null,"Votes":0,"qid":null,"qtext":null},
{"Aid":5,"Arank":2,"Atext":"no","ClientId":null,"Votes":0,"qid":null,"qtext":null},
{"Aid":6,"Arank":3,"Atext":"i don't know","ClientId":null,"Votes":0,"qid":null,"qtext":null}]}

I am able to retrieve the 1st array data after looping the dp arraycollection list.

if(i==0)
{
 trace("Show me:",obj.qtext);
}
O/P: Show me: Who will win 2011 football world cup?

How do I retrieve the 2nd, 3rd, 4th and so on (if it has) array datas individually and dynamically. Say, I want to take ‘Atext’ from all the array. Please help. I use flashbuilder4.5..

  • 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-28T02:49:34+00:00Added an answer on May 28, 2026 at 2:49 am

    From your output above, GetVotesResult is an Array of Objects which you can iterate over using a for / for each loop, eg:

    var result : String = "";  // JSON String omitted for brevity
    
    // Decode the JSON String into an AS3 Object graph.
    var data : Object = JSON.decode(result);
    
    // reference the GetVotesResult Array from the result Object.
    var votes : Array = data["GetVotesResult"];
    
    // Iterate over each 'Vote' object in turn and pull out the 
    // 'Atext' values the objects contain into a new Array.
    var Atexts : Array = [];
    for each (var vote : Object in votes) 
    {
        // Check for the existance of the 'aText' property.
        if (vote.hasOwnProperty("Atext")) {
            Atexts.push(vote.Atext);
        }
    }
    
    // Dump out all the aText values: (,yes, no, i)
    trace("Atexts: " + Atexts.join(", "));
    

    Alternatively you may wish to copy the objects into a Map Data Structure (a Dictionary in AS3) to create a lookup table based on one of the Keys:

    // Create a new, empty Lookup Table.
    var votesByAid : Dictionary = new Dictionary();
    
    // Iterate through the Vote Objects and add each one to the 
    // lookup table based on it's Aid property.
    for each (var vote : Object in votes) 
    {
        // Check for the existance of the 'aId' property to stop
        // any 'nulls' getting into our Lookup Table.
        if (!vote.hasOwnProperty("Aid")) {
            trace("Vote Object did not contain an `Aid` property.");
            continue;
        }
    
        // Add the entry to the lookup table.
        var key : String = vote.Aid;
        votesByAid[key] = vote;
    }
    
    // You can now use the lookup table to fetch the Vote Objects.
    trace(votesByAid[6].Atext); // traces 'i don't know'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public function create():ArrayCollection{ var index:int = 0; var data:ArrayCollection = new ArrayCollection(); var length:int
I used the following function: function datediff() { var dat1 = document.getElementById('date1').value; alert(dat1);//i get
In my project i used this below function public function createIconMenu():NativeMenu{ var iconMenu:NativeMenu =
I have used Javascript onlaod like this: function check() { var pic = new
I have this ArrayCollection filled with a xml data coming from and HttpService request.
i used array collection sort method like below . but still sorting wrongly .
I have used this : var watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default); Where Hgh means GPS
I query my data from database to display in my view. I used this
I am trying to get the data from the form I created where I
I come from PHP background and am used to doing var_dump , echo 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.