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

  • Home
  • SEARCH
  • 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 4250492
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:32:08+00:00 2026-05-21T04:32:08+00:00

I have a flex app that used to be an internet based app. In

  • 0

I have a flex app that used to be an internet based app. In it I have a function that creates tooltip error messages when I tell it to create an error message. I pulled this app out verbatim to a desktop app and restructured things a bit to get it to run, but I did not mess with the core fundamentals of the mxml file that utilizes this aside from changing the root tag from a type of ‘s:Group’ to ‘s:Window’

Everything runs correctly, but the tooltips are not displaying. I can’t seem to figure out why, so I thought I’d run this by you guys. Here’s the tooltip code (inline mxml code in the fx:script cdata tag):

import mx.controls.ToolTip;
import mx.managers.ToolTipManager;

public var errorTip:ToolTip;    
private function createErrorMsg(errorMsg:String, object:Object):void {              
    if (errorTip){ToolTipManager.destroyToolTip(errorTip);};
    errorTip = ToolTipManager.createToolTip(errorMsg,object.getBounds(root).x + object.width,object.getBounds(root).y) as ToolTip;
    errorTip.setStyle("styleName", "errorTip");
    errorTip.visible = true;
    errorTip.enabled = true;
}

Basically, I pass the function a string and an object (text input, checkbox, button, etc…etc…) and it positions it and displays the error message. This fully works in my web version, but not in my desktop version.

Here’s the code that instantiates the window:

var window:LoginWindow = new LoginWindow();
Window.systemChrome = NativeWindowSystemChrome.NONE;
Window.transparent = true;
Window.open(true);
Window.maximize()

Any ideas?


On a side note, I check to see if the errorTip exists at the beginning of the function and then destroy it so that the higher scoped variable ‘errorTip’ always equals the reference to the currently displayed error. This allows me to just destroy that error tip on form validation and then error check again, but it only allows one tooltip to be displayed at a time. Is there a better way to query the tooltip manager for all of it’s currently displayed tooltips and destroy them all?

  • 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-21T04:32:09+00:00Added an answer on May 21, 2026 at 4:32 am

    To resolve this you must change the line that calls ‘createTooltip’ to the following:

    errorTip = ToolTipManager.createToolTip(errorMsg,object.getBounds(root).x + object.width,object.getBounds(root).y, null, object as IUIComponent) as ToolTip;
    

    The idea behind this is that you can now just call ‘createErrorMsg(“myError”,myComponent)’ and it’ll display an error message there, which you can then add another function:

    private function clearError():void
    {
        if(errorTip) errorTip.visible = false;  
    }
    

    to actually remove the error message. The down side of this is that it only displays one message at a time but I’ll tweak it a bit to change that up. So here’s my better resolution:

    Error messages will (traditionally) only be displayed in a batch set. (Basically you will only have a handful of tooltips displayed at one point in time and they will all be related to the form you are on). This won’t always be true, but that’s not my concern here. I created a utility class that performs error message handling:

    package Utils
    {
        import mx.controls.ToolTip;
        import mx.core.IUIComponent;
        import mx.managers.ToolTipManager;
    
        public class ErrorUtils
        {
            private static var errorCache:Array = new Array();
    
            public function ErrorUtils()
            {
    
            }
    
            public static function createErrorMsg(errorMsg:String, object:Object):void {
                var errorTip:ToolTip = ToolTipManager.createToolTip(errorMsg,object.getBounds(object.root).x + object.width,object.getBounds(object.root).y, null, object as IUIComponent) as ToolTip
                errorTip.setStyle("styleName", "errorTip"); 
                errorTip.visible = true;
                errorTip.enabled = true;
    
                var position:int = errorCache.length;
                errorCache.push(errorTip);
            }   
    
            public static function clearAllErrors():void
            {
                for each(var error:ToolTip in errorCache)
                {
                    ToolTipManager.destroyToolTip(error);
                }
            }   
        }
    }
    

    To use the class you simply call ErrorUtils.createErrorMsg(“my message”,invalidComponent), and to clear the errors you simply call ErrorUtils.clearAllErrors()

    That way if you have a form and you have a validation function for it, you simply call that function every time it comes back as invalid. The only thing that this is missing is any kind of way to clear a specific error, but to handle that you could place all of the creation calls inside of a master validation function that validates all the fields in your form, then call that each time you gain or loose focus on a field and call ‘ErrorUtils.clearAllErrors()’ at the beginning of the function.

    BTW:
    this is the source of the original tutorial I received to do this, I just abstracted it a bit
    http://aralbalkan.com/1125
    so credits go to the above site for the original code

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

Sidebar

Related Questions

I have a Flex App that allows you to dynamically build an animation. It
I have created an ashx handler that returns an image to my flex app.
I have a Flex application that calls a function which searches a large document
I have a requirement on my current project (a Flex app which will be
I have a simple little test app written in Flex 3 (MXML and some
So, I have Flex project that loads a Module using the ModuleManager - not
I have a flex application that needs the ability to generate and execute JavaScript.
I have a Flex ComboBox that gets populated by a dataprovider all is well...
I have a Flex swf hosted at http://www.a.com/a.swf . I have a flash code
I have a Flex application where I'm using a Canvas to contain several other

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.