Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6611243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:56:44+00:00 2026-05-25T19:56:44+00:00

I want to have a tooltip that shows different things when the mouse goes

  • 0

I want to have a tooltip that shows different things when the mouse goes over a different part of a component. For example if it is the top half of a component it will show one tooltip. If the mouse is on the bottom half of the segment then the tooltip will be another. I have some code I have written that returns a panel with string in. This code is on another computer so I’ll post code tomorrow.

Is it possible in ActionScript to have different tooltips (or rather differnt values in a tooltip) for different parts of a segment?

The code I have so far is:

MyToolTip.mxml

<?xml version="1.0"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml"
implements="mx.core.IToolTip" 
alpha=".9" width="325" borderColor="black" borderStyle="solid"
cornerRadius="10" horizontalAlign="center">
<mx:Script><![CDATA[
[Bindable]
public var toolTipText:String = "";

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

<mx:HBox width="100%" height="100%">
<mx:Text text = "Text here" width = "50%"/>
<mx:Text text = "{toolTipText}" width = "50%"/>
</mx:HBox>  
</mx:Panel>

And then my action script class component that I want the tooltip to be against.

public class MyComponent extends mx.containers.VBox {

    private var tt:MyToolTip 

    public function MyComponent() {
        this.addEventListener(ToolTipEvent.TOOL_TIP_CREATE, toolTipCreateHandler);
        this.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
        tt = new MyToolTip();
    }

    override protected function drawFigure():void {
        //Need to kick the TOOL_TIP_CREATE event...and needs to be a value (eg a SPACE). 
        //If blank then no tooltip is created 
        this.toolTip = " ";
        super.drawFigure();
    }

    private function toolTipCreateHandler(event:ToolTipEvent):void {
        var toolTipText:String = "tooltip1";
        eventToolTip.toolTipText = toolTipText;
        event.toolTip = tt;
    }

    private function mouseOverHandler(event:MouseEvent):void {
        //perhaps I need to be more efficient here and only fire
        //when the mouse goes into top half or bottom half
        //This does not appear to update the toolTipText in the view
        var halfwayUp:Number = getBounds(this).height  / 2;
        if (event.localY < halfwayUp) {
            eventToolTip.toolTipText = "tooltip2";
        }
        else {
            eventToolTip.toolTipText = "tooltip1";
        }           
    }
}
}

Any help or pointers in how to update the tooltip when it is already displaying would be great.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:56:44+00:00Added an answer on May 25, 2026 at 7:56 pm

    Yes, its possible, the trick is to know how tooltips work:
    Tooltips get created, if you mouse over a component, and are destroyed if you mouse out. So if you change the text on a tooltip while its displayed, then you wont see the change, because the set toolTip() function does not creates a new tooltip, if one already exists. So the solution is to destroy the currently showing tooltip, and make a new one. To destroy a tooltip, you can set its value to an empty string.
    Here is a sample code:

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" 
    mouseMove="application1_mouseMoveHandler(event)">
    <mx:Script>
    <![CDATA[
        import mx.managers.ToolTipManager;
    
        protected function application1_mouseMoveHandler(event:MouseEvent):void{
            if (mouseX < 100) {
                testButton.toolTip = ""
                testButton.toolTip = "on the left side";
            } else {
                testButton.toolTip = ""
                testButton.toolTip = "on the right side";
    
            }
        }
    
    ]]>
    </mx:Script>
    <mx:Button id="testButton" label="test" width="200" height="200" />
    </mx:Application>
    

    Note: If you want to mess more with tooltips in Flex, you can get the current tooltip with ToolTipManager.currentToolTip (and modify its properties without destroying it).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to show a tooltip based on mouse over event . I have
I have a tooltip that activates(shows) when the target text is hovered over. For
I have an abstract UserControl that I want to show a ToolTip on. This
I have a popup system that shows a image when you hover over a
i have one image and i want that when i will home mouse on
I have used a few different tooltip plugins over the years, but I think
I have a custom control (C#, visual studio). I want to show a tooltip
I want to have a select-only ComboBox that provides a list of items for
I want to have a text box that the user can type in that
I have a component to which I assign a tooltip upon first mouseenter (sort

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.