Note that there are some explanatory texts on larger screens.

plurals
  1. POConvert TextArea into TextField in AS3
    primarykey
    data
    text
    <p>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).</p> <p>How can I do it?</p> <p>I'm doing this, but didn't work:</p> <pre><code>element.addEventListener(MouseEvent.DOUBLE_CLICK, changeName); private function changeName(e:MouseEvent):void{ e.target.type = TextFieldType.INPUT; } </code></pre> <p>Where <code>element</code> is a TextArea (clasic and dynamic text). Thanks!</p> <p><strong>EDIT:</strong></p> <p><img src="https://i.stack.imgur.com/26e36.jpg" alt="enter image description here"></p> <p>This is how my MovieClip looks. "Name" is the TextArea that I want to allow user changes. I'm setting it like this:</p> <p><img src="https://i.stack.imgur.com/4Gpqv.jpg" alt="enter image description here"></p> <p>[Spanish interface]</p> <ol> <li>Nombre de instancia = Instance name (empty)</li> <li>Texto clásico (classic text)</li> <li>Texto dinámico (dynamic text)</li> </ol> <p>The MovieClip is controlling my by own base class (called 'ConfLayer'). Inside it I have this:</p> <pre><code>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; } </code></pre> <p>Because AS3 gives me errors, I tried this:</p> <pre><code>private function changeName(e:MouseEvent):void { e.target.TextField.type = TextFieldType.INPUT; } </code></pre> <p>When I double-click on TextArea element, the previous string removes and I can't write nothing.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload