4 Replies Latest reply on Jul 20, 2007 5:04 AM by msabljic

    How to remember checkbox values for each image

    msabljic Level 1
      The situation is this: i have a horizontal list which i populate with images loaded from xml. After i click on any of the images, popup windows is displayed with checkbox. The same popup is displayed for all of the images after i click on them. I need to remember checkbox values (on/off) for each one of the images in horizontal list but i don't know how to do that? How can i know which one of the images (they are different) inside horizontal list i clicked on in the first place?

      thank you
        • 1. Re: How to remember checkbox values for each image
          ntsiii Level 3
          Have you pop-up update a property in the dataProvider item associated with the clicked element.

          Tracy
          • 2. Re: How to remember checkbox values for each image
            msabljic Level 1
            I am sorry but i don't quite follow you, i am not sure what you are saying so i would really appreciate it if you could explain it to me a little bit further. I have the following mxml code where i define my HorizontalList:

            <mx:HorizontalList height="326" width="935" id="imageList" itemRenderer="mx.controls.Image" columnWidth="427" rowHeight="320" itemClick="popUpWindow()" backgroundColor="#4A4A4A" borderColor="#444242" themeColor="#000000" verticalCenter="166" horizontalCenter="0">
            </mx:HorizontalList>

            and following "popUpWindow()" function which i call when image in HorizontalList is clicked:

            //previously i populate horizontal list with images from an array "slidePathAC"
            imageList.dataProvider = slidePathAC;

            public function popUpWindow():void{
            trace ("\npopUpWindow function")
            var tw:TitleWindow = new TitleWindow();

            tw.showCloseButton = true;

            tw.setStyle("borderAlpha",0.9);

            mx.managers.PopUpManager.addPopUp(tw, MainPanel, true);

            tw.width = 500;
            tw.height = 500;
            mx.managers.PopUpManager.centerPopUp(tw);

            tw.addEventListener("close",removePopUp);
            }

            Thank you very much for your help
            • 3. Re: How to remember checkbox values for each image
              ntsiii Level 3
              In the removePopUp function, get the checkbox state from the popup, and set its value in a property on the HorizontalList.selectedItem, which is an element of slidepathAC:
              myHL.selectedItem.isChecked = tw.isChecked. Of course you will need an instance variable with a reference to tw for this.

              There are other ways. Here is an example that shows popup communication:
              http://www.cflex.net/showFileDetails.cfm?ObjectID=558

              Tracy
              • 4. Re: How to remember checkbox values for each image
                msabljic Level 1
                I think i got it now, i 'll try to do that. Thank you very much Tracy. I really appreciate your time and help

                cheers