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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:29:41+00:00 2026-05-11T20:29:41+00:00

I built a quiz game with a cartoon question bubble. The bubble is re

  • 0

I built a quiz game with a cartoon question bubble. The bubble is re sized to the length of the question. I want to a change event on the dynamic textbox to call a function that changes the size of the question bubble.

However, the change event is never called when my textbox value is modified dynamically from code.

 question_txt.addEventListener(Event.CHANGE, setTextBubbleSize);

 function setTextBubbleSize(event:Event):void
    {
        trace("QUESTION TEXT CHANGED");
        textBubble_mc.height = 30 + question_txt.text.length * 1.2;
        if (textBubble_mc.height > 170) textBubble_mc.height = 170;
        question_txt.y = textBubble_mc.y - textBubble_mc.height / 6 + 10;
    }

I want to use the change event because there are several places in my code that question_txt can be set. How can I get the textbox to fire the change event?

Also, is there a way to count the number of lines in question_txt to more accurately set the height of textBubble_mc?

  • 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-11T20:29:41+00:00Added an answer on May 11, 2026 at 8:29 pm

    Yes, as David comments, TextField only dispatches CHANGE events when it’s being edited by user input – in fact, this is generally true of most components. The reason, of course, is because if you manually tried to change the field’s value inside your “change” handler, you’d make a recursive cycle of events that you’d have to manually detect your way out of.

    What you want to do is make a wrapper function, like:

    function setQuestionText( s:String ):void
        {
            question_txt.text = s;
            setTextBubbleSize();
        }
    

    For your other question, there is no reason to estimate the textfield’s height based on the number of lines or characters – just set the text property, and you can immediately query the textfield’s height. It will accurately reflect the field’s new height, and if you change the field’s width, the height will immediately be updated, etc.

    Or, if you need to know any fine details about the size of the text field, you can always use TextExtent.

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

Sidebar

Ask A Question

Stats

  • Questions 248k
  • Answers 248k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can specify external style sheets with the following attributes… May 13, 2026 at 8:50 am
  • Editorial Team
    Editorial Team added an answer You can create an image that is a couple pixels… May 13, 2026 at 8:50 am
  • Editorial Team
    Editorial Team added an answer You can cast the object to an array and use… May 13, 2026 at 8:50 am

Related Questions

We have a little in-house LMS with courses built in Flash. Scores are updated
After reading this on the question How do I uniquely identify computers visiting my
Alright, I'm at a loss with the Django Forms, as the documentation just doesn't
These two 1-hour videos show step-by-step how to use the MVVM pattern to build

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.