0 Replies Latest reply on Jan 25, 2011 10:56 PM by Pandaheihei

    Question on AsyncToken

    Pandaheihei

      Hello,

       

      I have an issue with my asynctoken in trying to retrieve the content into an ArrayCollection. I want to retrieve it from the data/services to my mxml component. It does get retrieved, but all the data in the array seems to be the name of the asynctoken or the data when i try to retrieve it using the asynctoken.

      I do realise that I need the have the "getSentimentAllByBean.get(j).getContent());" in the mxml, but how do i do that?

       

      I can get the data through this:

       

      Data.java

          public static void main(String[] args){

              Data d = new Data();
              for(int j=0; j<d.getSentimentAllByBean().size(); j++){

       

                  //System.out.println(d.getSentimentAllByType("positive").get(j).getContent());
                 
                  System.out.println(d.getSentimentAllByBean().get(j).getContent());
              }

       

      Output:  (if i have 5 content in my data)

      i like my first content bean
      i love my first content bean
      i dont know my first content bean
      i like my first content bean
      this is negative feeling.not good

       

       

      This is how i'm calling my asyncToken

      JavaTagCloud.mxml :

       

       

      private var allSentiment:ArrayCollection = new ArrayCollection;

       

      private function load(event:FlexEvent):void
      {
           getAllSentiment.token = data.getSentimentAllByBean();

      }

      protected function getAllSentiment_resultHandler(event:ResultEvent):void
              {
       
                  allSentiment = event.result as ArrayCollection;
                 
                  if(allSentiment != null){
                      Alert.show("result is not null");
                      Alert.show("this is allSentiment :" + allSentiment.list);
                  }
                  else
                      Alert.show("result is null");
              }          

       

      <mx:CallResponder id="getAllSentiment" result="getAllSentiment_resultHandler(event)" />

       

       

      Output : (in this case, if I have 5 data)

      this is allSentiment : [object TwitterContentBean],[object TwitterContentBean],[object TwitterContentBean],[object TwitterContentBean],[object TwitterContentBean]

       

       

       

      How am i able to have my mxml retrieve the content data, instead of the object ? ?

       

       

      Thanks (: