10 Replies Latest reply on Nov 25, 2010 2:21 AM by Vaasan

    tooltip problem

    flash search

      HI all

      I am facing a problem using a tool tip on tile list image.I am using flex 3. i need to display some data in custom tooltip.as i used itemrenderer to display the image in tile list it is possible by using simple tooltip.but unable to use custom one.If required I can show the code i used to display image. Please help me in this problem.

       

      Thanks and regards

        • 1. Re: tooltip problem
          RUSH-ME Level 3

          Hi

           

          Have you tried using html text and its img tag?

           

          Rush-me

          • 2. Re: tooltip problem
            flash search Level 1

            thank you for your reply. I am new to flex buider 3 thats why unable to understand what are you talking about.can you please give me a detail idea about this.and i need to show content of some varriable in the tool tip.

            • 3. Re: tooltip problem
              FinFlex Level 1

              Try this one http://www.files.riacodes.com/flex_custom-tooltip/demo/  Right click to view source.

              • 4. Re: tooltip problem
                flash search Level 1

                Thank You for your reply i saw this example i tried this one but unable to execute as i am using tilelist to view the image.To display the image in tilelist i used itemrenderer. May be thats the reason the code is not working.my code

                <?xml version="1.0" encoding="utf-8"?>

                 

                <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" horizontalAlign="center"
                        verticalAlign="middle" borderStyle="solid" borderColor="black" borderThickness="1">
                    <mx:Image id="asd" maintainAspectRatio="false" source="data/earrings/extention/{data}" scaleContent="true" width="60" height="60" toolTip="{data.@name + data.@price}"/>
                </mx:VBox>

                 

                if i make you understand please help me

                • 5. Re: tooltip problem
                  FinFlex Level 1

                  if image have an tootip create event, you can call function by using parentDocument.yourTooltipCreationFunction();

                   

                  <?xml version="1.0" encoding="utf-8"?>

                   

                  <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"  horizontalAlign="center"
                          verticalAlign="middle"  borderStyle="solid" borderColor="black" borderThickness="1">
                       <mx:Image id="asd" maintainAspectRatio="false"  source="data/earrings/extention/{data}" scaleContent="true" width="60"  height="60" toolTip="{data.@name + data.@price}" toolTipCreation="{parentDocument.yourTooltipCreationFunction();}"/>
                  </mx:VBox>

                   

                  Im kinda hurry now, so didnt have a time to check this properly. Hope you got some help.

                  • 6. Re: tooltip problem
                    flash search Level 1

                    Thank you again

                    sure sir I will check and give u reply

                    • 7. Re: tooltip problem
                      flash search Level 1

                      I tried your method may be something wrong with my process when i used parentDocument flex showing the error unable find parentDocument.please help me.

                       

                      Thank you

                      • 8. Re: tooltip problem
                        FinFlex Level 1

                        So this is the component of which you use on list as a item renderer?

                         

                        <?xml version="1.0" encoding="utf-8"?>

                         

                        <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"   horizontalAlign="center"
                                verticalAlign="middle"   borderStyle="solid" borderColor="black" borderThickness="1">
                              <mx:Image id="asd" maintainAspectRatio="false"   source="data/earrings/extention/{data}" scaleContent="true" width="60"   height="60" toolTip="{data.@name + data.@price}"  toolTipCreation="{parentDocument.yourTooltipCreationFunction();}"/>
                        </mx:VBox>

                         

                        Add this to your itemrenderer:

                        toolTipCreate="parentDocument.myTooltipCreationFunction();"

                         

                         

                        On your main application you can make this function of which handles the tooltip creation.

                         

                        <?xml version="1.0" encoding="utf-8"?>


                        <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
                           
                            <mx:Script>
                                <![CDATA[
                               
                                public function myTooltipCreationFunction():void
                                {
                                     //do your tricks here
                                }
                                   
                                ]]>
                            </mx:Script>
                           
                        </mx:Application>

                         

                        Be sure your function is public.

                        • 9. Re: tooltip problem
                          flash search Level 1

                          Thanks for your reply,

                          I tried your code but still its not showing

                          the main function i used in the parent mxml is

                           

                          import customTooltip;

                          import mx.events.ToolTipEvent;
                                 
                                  public function createCustomTip(title:String, body:String, event:ToolTipEvent):void {
                                     var ptt:customTooltip = new customTooltip();
                                     ptt.title = title;
                                     ptt.bodyText = body;
                                     event.toolTip = ptt;
                                  }

                          and i used it in itemrenderer like this

                          <?xml version="1.0" encoding="utf-8"?>

                           

                          <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" horizontalAlign="center"
                                  verticalAlign="middle" borderStyle="solid" borderColor="black" borderThickness="1">
                                  <mx:Image id="asd"
                                      maintainAspectRatio="false"
                                      source="data/earrings/extention/{data}"
                                      scaleContent="true" width="60" height="60"
                                      toolTip="" toolTipCreate="parentDocument.createCustomTip()"/>
                          </mx:VBox>

                          but its not working don't know the reason,may be i need to pass the value wih i need to display.

                           

                          Here is the custom tooltip function

                          <?xml version="1.0"?>
                          <!-- tooltips/ToolTipComponents/PanelToolTip.mxml -->
                          <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml"
                              implements="mx.core.IToolTip"
                              width="200"
                              alpha=".8"
                              borderThickness="2"
                              backgroundColor="0xCCCCCC"
                              dropShadowEnabled="true"
                              borderColor="black"
                              borderStyle="solid"
                              title="feh"
                          >
                              <mx:Script><![CDATA[
                                  [Bindable]
                                  public var bodyText:String = "";
                             
                                  //  Implement required methods of the IToolTip interface; these
                                  //  methods are not used in this example, though.
                                  public var _text:String;

                           

                                  public function get text():String {
                                      return _text;
                                  }
                                  public function set text(value:String):void {
                                  }
                              ]]></mx:Script>

                           

                              <mx:Text text="{bodyText}" percentWidth="100"/>

                           

                          </mx:Panel>

                          I got this from http://livedocs.adobe.com/flex/3/html/help.html?content=tooltips_4.html here.Please help me.

                          • 10. Re: tooltip problem
                            Vaasan

                            hii,

                             

                            I was also facing the same problem ..

                            The code seems to be fine, and a space has caused this problem

                             

                            <mx:Image id="asd"
                                        maintainAspectRatio="false"
                                        source="data/earrings/extention/{data}"
                                        scaleContent="true" width="60" height="60"
                                       toolTip=" " toolTipCreate="parentDocument.createCustomTip()"/>

                             

                            //  a space in tooltip=" " instead of tooltip="" wil solve the problem 

                             

                             

                            Thanks,

                            Vasan