4 Replies Latest reply on Jun 2, 2011 6:27 PM by Uh.mxml

    Bubbling Images

    Uh.mxml

      Dear all,

       

      I'm trying to put some events on images that are inside an HorizontalList.


      Here is the code:

       

      <mx:HorizontalList width="914" height="66" dataProvider="{listDataDenteInferior.item  }" x="10" y="94">
               <mx:itemRenderer >
                       <mx:Component>
                                  <mx:VBox paddingTop="2" paddingRight="0" paddingBottom="2" paddingLeft="0"   >
                                           <mx:Image source="{ data.image }" width="57" height="57" click="EVENT GOES HERE"/>
                                  </mx:VBox>
                       </mx:Component>
                 </mx:itemRenderer>
      </mx:HorizontalList>

       

      I would like to show a simple alert when I click. That's all


      Thank y'all.

        • 1. Re: Bubbling Images
          Lee Burrows Level 4

          hi

           

          have you tried this?

           

          click="Alert.show('your message', 'your title');"

          1 person found this helpful
          • 2. Re: Bubbling Images
            Uh.mxml Level 1

            Hey Lee,

             

            Thank you. Your answer was very helpful, but it didnt solve the whole stuff.

             

            the "Alert" would be just the first step. I really want to put a complex event inside this image.
            The problem is that when i put

             

            click="goToThisEventHere()" it never works.
            A message appears saying that it's not possible to do such operation with such component.
            The message is

             

            "1180: Call to a possibly undefined method goToThisEventHere()"

             

            Do you have any idea about what to do?

            • 3. Re: Bubbling Images
              Lee Burrows Level 4

              this may work(?):

               

              <mx:Component>

                   <fx:Script>

                        private function clickHandler():void

                        {

                             trace("do stuff");

                        }

                   </fx:Script>
                   <mx:VBox paddingTop="2" paddingRight="0" paddingBottom="2" paddingLeft="0"   >
                   <mx:Image source="{ data.image }" width="57" height="57"click="clickHandler()"/>
                   </mx:VBox>
              </mx:Component>

              • 4. Re: Bubbling Images
                Uh.mxml Level 1

                Woah!

                 

                It works. I just had to do minor changes (mx:Script instead fx:Script )

                 

                But the rest was perfect!

                 

                Thank you very much!