3 Replies Latest reply on Jul 26, 2007 1:27 PM by schjlatah

    event

    Level 7
      Hi all,
      After calling a remote service I collected the data into an arrayCollection.
      Can I collect the same result in two arrayCollections and they can work
      alone?
      I try this but looks like is keeping the same values for both if I use
      different filterFunction.
      Tks

      JFB

      public function getService_Handler(event:ResultEvent):void
      {
      acFirst = ArrayCollection(event.result);
      acSecond = ArrayCollection(event.result);

      acFirst.filterFunction = firstFilter;
      acSecond.filterFunction = secondFilter;
      }


        • 1. Re: event
          ntsiii Level 3
          Doing that makes both variables point to the same reference (the event.result).

          Try this (untested):
          acFirst = new ArrayCollection(event.result);
          acSecond = new ArrayCollection(event.result);

          It that behaves the same way, we'll try something like:
          acFirst = new ArrayCollection(event.result);
          var aCopy:Array = acFirst.source.concat(); //this is a "shallow" copy
          acSecond = new ArrayCollection(aCopy);

          Tracy
          • 2. Re: event
            Level 7
            No luck with this way.
            I try different way.
            Create a new arrayCollection variable and in the filter function add the
            items to each array depending on the value.
            Thanks

            JFB


            "ntsiii" <tspratt@lariatinc.com> wrote in message
            news:f88hlu$7kd$1@forums.macromedia.com...
            > Doing that makes both variables point to the same reference (the
            > event.result).
            >
            > Try this (untested):
            > acFirst = new ArrayCollection(event.result);
            > acSecond = new ArrayCollection(event.result);
            >
            > It that behaves the same way, we'll try something like:
            > acFirst = new ArrayCollection(event.result);
            > var aCopy:Array = acFirst.source.concat(); //this is a "shallow" copy
            > acSecond = new ArrayCollection(aCopy);
            >
            > Tracy
            >


            • 3. Re: event
              schjlatah Level 1
              I had some troubles with arrays too. Check out this thread. It may help with your reference issue.
              http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=587&threadid=1211199