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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:18:05+00:00 2026-05-25T17:18:05+00:00

I’ve a TextArea component in my MovieClip. When I double click on it, I

  • 0

I’ve a TextArea component in my MovieClip. When I double click on it, I want to switch to TextField component, allowing me to change its content. When I click outside, I want to restart its original class (TextArea).

How can I do it?

I’m doing this, but didn’t work:

element.addEventListener(MouseEvent.DOUBLE_CLICK, changeName);

private function changeName(e:MouseEvent):void{
   e.target.type = TextFieldType.INPUT;
}

Where element is a TextArea (clasic and dynamic text). Thanks!

EDIT:

enter image description here

This is how my MovieClip looks. “Name” is the TextArea that I want to allow user changes. I’m setting it like this:

enter image description here

[Spanish interface]

  1. Nombre de instancia = Instance name (empty)
  2. Texto clásico (classic text)
  3. Texto dinámico (dynamic text)

The MovieClip is controlling my by own base class (called ‘ConfLayer’). Inside it I have this:

public function doStuff(e:MouseEvent):void{
   // element = TextArea 'Name'
   element.addEventListener(MouseEvent.DOUBLE_CLICK, changeName);
}

private function changeName(e:MouseEvent):void {
   var tarea:TextArea = e.target as TextArea;
   var tf:TextField = tarea.TextField;    // this line throwing error
   tf.type = TextFieldType.INPUT;
}

Because AS3 gives me errors, I tried this:

private function changeName(e:MouseEvent):void {
   e.target.TextField.type = TextFieldType.INPUT;
}

When I double-click on TextArea element, the previous string removes and I can’t write nothing.

  • 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-25T17:18:06+00:00Added an answer on May 25, 2026 at 5:18 pm

    I solved my own problem using background and border properties from TextField. Instead of create TextField directly on my MovieClip, I create it dynamically.

    // Field 'Name' of the layer
    var tarea:TextField = new TextField();
    tarea.text = 'Layer';
    tarea.x = -80;
    tarea.y = -23;
    tarea.type = TextFieldType.DYNAMIC;
    tarea.height = 20;
    
    // Format the TextField
    var format_tarea:TextFormat = new TextFormat();
    format_tarea.font = "Arial";
    format_tarea.size = 14;
    format_tarea.bold = true;
    
    tarea.setTextFormat(format_tarea,0,tarea.length);
    

    Then, I add it some listeners to allow changes when I click on it:

    // Add event to allow name changes
    tarea.addEventListener(MouseEvent.CLICK,changeName);
    

    When I press ENTER key, I accept the changes

    // Add event to accept changes on press ENTER key
    tarea.addEventListener(KeyboardEvent.KEY_DOWN,acceptKeyboardName);
    

    When TextField lost his focus, accept the changes too:

    tarea.addEventListener(FocusEvent.FOCUS_OUT,acceptFocusName);
    

    Last, I added to my own MovieClip

    // Add to MC
    mc.addChild(tarea);
    

    Handlers associated to below events are these:

    private function changeName(e:MouseEvent):void
    {
        e.target.setSelection(0,e.target.text.length);
        e.target.border = true;
        e.target.background = true;
        e.target.type = TextFieldType.INPUT;
    }
    
    private function acceptKeyboardName(e:KeyboardEvent):void
    {
        if (e.charCode == 13)   // When pres ENTER, remove border, background and restore dynamic type
        {
            e.target.type = TextFieldType.DYNAMIC;
            e.target.border = false;
            e.target.background = false;
        }
    }
    
    private function acceptFocusName(e:FocusEvent):void
    {
        // When lost focus, remove border, background and restore dynamic type
        e.target.type = TextFieldType.DYNAMIC;
        e.target.border = false;
        e.target.background = false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I want to show the soap response to UIWebview.. my soap response is, <p><img
I'm trying to select an H1 element which is the second-child in its group
I want to construct a data frame in an Rcpp function, but when I
i want to parse a xhtml file and display in UITableView. what is the

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.