4 Replies Latest reply on May 28, 2012 5:43 PM by 56231

    arraycollection only works when there is more than one item.

    56231 Level 1

      Flex 4.6.   XML is generated by php.

      <imgtex>

         <image>

            <pic_no>

            </pic_no>

            <pic>

            </pic>

            <tex>

            </tex>

         </image>

      </imgtex>

       

      When the xml has more than one row of (pic_no, pic, tex); For Example:

      <pic_no>01</pic_no>

      <pic>some.jpg</pic>

      <tex>some text</tex>

      <pic_no>02</pic_no>

      <pic>some2.jpg</pic>

      <tex>some text2</tex>

      The dataGrid and Alert.show() fills with this info. But if there is just one row of (pic_no, pic, tex), the dataGrid remains empty and Alert.show() doesn't even display.

       

      Is there something still missing from my code? Does just one item in ArrayCollection need to be handled differently? Thanks.

       

      import mx.collections.ArrayCollection;

      [Bindable] private var img:ArrayCollection;

       

      private function getImgResult(event:ResultEvent):void {

               img = event.result.imgtex.image;

               mx.controls.Alert.show("img=" + img);

      }