4 Replies Latest reply on Dec 31, 2010 3:32 PM by kiran7881

    Flex 3 : how to put a Cross Mark on this displayed Canvas (For Cancelation )

    kiran7881 Level 1

      Hi ,
      Depending upon the click of the button , i am displaying a Search Component , made of Canvas .
      public function openSearchCOmp():void
              {
                  var a:comps.SearchComp = new SearchComp();
                  a.height=233;
                  a.width=450;
                  a.x=314;
                  a.y=106;
                  a.verticalScrollPolicy="off";
                  a.horizontalScrollPolicy="off";
                  Application.application.addChild(a);
                          
              }

       

      Now Please tell me , how to put a Cross Mark on this displayed  Canvas (For Cancelation ) please suggest .

        • 1. Re: Flex 3 : how to put a Cross Mark on this displayed Canvas (For Cancelation )
          Gregory Lafrance Level 6

          Your best bet is to add an X icon image to your component, and when clicked it calls a method in its parent that removes the component.

           

          If this post answers your question or helps, please mark it as such. Thanks!

          http://www.chikaradev.com
          Adobe Flex Development and Support Services

          • 2. Re: Flex 3 : how to put a Cross Mark on this displayed Canvas (For Cancelation )
            kiran7881 Level 1

            Thanks for the prompt reply :

             

            It was a good idea , unfortunately i got a problem in implementing that ,

             

             

            <mx:Canvas  xmlns:mx="http://www.adobe.com/2006/mxml"  backgroundColor="#86ED7C" >
            <mx:Image click="callMe()" visible="true" source="Images/Cancel.jpeg" width="30" id="img">

             

                <mx:Script>
                    <![CDATA[
                        import mx.controls.Alert;
                       
                        public function callMe():void
                        {
                       
            // Here how can i make the entire Canvas visible to flase ??

             

                       
                        }
                    ]]>
                </mx:Script>

             

             

             


            I tried as

             

            this.removeChild(comps.SearchComp);
            this.removeAllChildren();

             

            But they weren't working , any idea ?

            • 3. Re: Flex 3 : how to put a Cross Mark on this displayed Canvas (For Cancelation )
              kiran7881 Level 1

              Upon clicking on a Search Link , i am displaying a Canvasand also canvas with cross Button as Image .

               

                      public function openSearchCOmp():void
                      {
                          a = new SearchComp();
                          a.height=233;
                          a.width=475;
                          a.x=314;
                          a.y=106;
                          a.verticalScrollPolicy="off";
                          a.horizontalScrollPolicy="off";
                          Application.application.addChild(a);
                 
                              img = new Image();
                              img.source = "Images/Cancel.jpeg";
                              img.width = 30;
                              img.height = 30;
                              img.x=454;
                              img.y=0;
                              a.addChild(img);
                      }

               

              This is working fne , how can i code for the Image click in this ??

               

               

              Any ideas ??

              • 4. Re: Flex 3 : how to put a Cross Mark on this displayed Canvas (For Cancelation )
                Gregory Lafrance Level 6

                What is flase?

                 

                The cancel icon should be in the component you want removed from the display list.

                 

                Create a public function in the parent of the component to remove, and for the cancel icon click handler, try this:

                 

                parentDocument.removeItem(this);

                 

                If this post answers your question or helps, please mark it as such. Thanks!

                http://www.chikaradev.com
                Adobe Flex Development and Support Services