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 8574519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:29:32+00:00 2026-06-11T19:29:32+00:00

I have a dynamic alert method that pops up an alert movieclip which tells

  • 0

I have a dynamic alert method that pops up an alert movieclip which tells the user that their search was not successful.

alert("Map [" + inputTxt + "] not found.");

Now, I would like to do something along the lines of

if (alertText.textWidth > myText.text.width) {
    myText.text = "Map not found.";
}

What this is supposed to do is not show the inputTxt variable if the total text in the textbox exceeds the textbox itself in size.

That which I have does not work. I am open to any suggestions (as long as they remain short and concise).

FURTHER INFORMATION:
alertText is the string fed into the object. myText.text is a textbox.
I want to check if alertText will fit in myText.text BEFORE putting it in the textbox.

-Olin

  • 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-06-11T19:29:34+00:00Added an answer on June 11, 2026 at 7:29 pm

    a string does not have a textWidth property. There is no (easy) way to know ahead of time if your text will fit, unless your using a font where every char is the same width.

    Here is a way to accomplish this:

    myText.text = alertText; //put the text in the box
    
    if(myText.textHeight > myText.height || myText.textWidth > myText.width){
        //the text does not fit in it's entirety.
        myText.text = "Map not found.";
    }
    

    This assumes your not using the autoSize property of the textField and are explicitly settings the width/height.

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

Sidebar

Related Questions

I have a dynamic tableview which has a prototype cell with a button that,
I have table which contains the rows that are dynamic from server side scripting(PHP)
I have an ASP.NET user control that I want to write some dynamic Javascript
I have dynamic listview on my android client app that receive data from remote
I have dynamic array filled with bytes, which are read from .raw file with
I have some divs that have dynamic heights controlled by a 'click' function as
I have some divs that have dynamic heights controlled by a 'click' function as
I have some dynamic buttons that look like this: <input type=button name=button id=button value=Click
I have this table where I can generate dynamic rows (which has input <type=text
I have a dynamic form where the user provides a name and description: <label>Name</label><br

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.