Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to add one symbol in between the user give input.

New Here ,
Sep 30, 2013 Sep 30, 2013

Hi,

     In my flash had the following code.

import flash.events.TextEvent;

tf.addEventListener(TextEvent.TEXT_INPUT, tfHandler);

function tfHandler(e:TextEvent):void{

    trace(e.target.text.length);

    if(e.target.text.length == 2){

        e.target.appendText("-");

        stage.focus = tf;

        tf.setSelection(tf.text.length,tf.text.length);

    }

}

     Like this How to do in AS2.?

Thanks with,

Viswa

TOPICS
ActionScript
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 30, 2013 Sep 30, 2013
LATEST

Use:

tf.onChanged = function(){

    if(tf.length == 3){

       tf.text += "-";

       Selection.setSelection(tf.text.length, tf.text.length);

    }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines