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

blink caret in a textfield in AS3

Guest
Nov 18, 2015 Nov 18, 2015

Copy link to clipboard

Copied

Hello everyone... euhm, i would like to have a "bink caret" (if it's the correct expression), in a textfield "input". Like this (after the "A:") :

94206-Ms_Dos_1.25_(1982)(Microsoft)-1.jpg

but when i search on the net for the "input textfield", it seems difficult.

So, if it's not possible, i thought about a solution, with for example :

a1.text (the input textfield)

levrai.text (the "label" textfield)

when the letters of the keyboard are detected in a1.Text, it's immediately copy in levrai.Text, where we put a "blink cursor", like this :

stage.addEventListener(KeyboardEvent.KEY_UP, keyDownHandler)

function keyDownHandler(ev:KeyboardEvent):void{

     levrai.text = a1.text + "â–ˆ";

}

It works... but i don't know to make a blinking caret, like this :

"blablablaâ–ˆ"

"blablabla"

"blablablaâ–ˆ"

"blablabla"

xD like a true old computer screen...

Any ideas, please?

TOPICS
ActionScript

Views

940

Translate

Translate

Report

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

correct answers 1 Correct answer

Deleted User
Nov 19, 2015 Nov 19, 2015

Thanks kglad but the solution with the movieclip seems difficult x)...

but finally i make this : I found and modify a script on the net, and it's works ..

So... I have an input textfield named "a1", a dynamic text field named "levrai", and a small textield named "cl" with a blink symbol inside ( â–ˆ )

When i write a text in the a1.text, it's automatically duplicate in the levrai.text + the super blinking cursor . And then the real cursor is not visible because it's a dynamic textfield... it's cool !!

...  
                

Votes

Translate

Translate
Community Expert ,
Nov 18, 2015 Nov 18, 2015

Copy link to clipboard

Copied

if you use an input textfield you'll see the default 'bar' cursor indicator.

if you want to use a custom cursor like you indicated, create a blinking cursor movieclip and add it to a movieclip that looks and acts like a textfield.  you can use an invisible textfield to capture keyboard input and display that in your movieclip that acts like a textfield.

Votes

Translate

Translate

Report

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
Guest
Nov 19, 2015 Nov 19, 2015

Copy link to clipboard

Copied

LATEST

Thanks kglad but the solution with the movieclip seems difficult x)...

but finally i make this : I found and modify a script on the net, and it's works ..

So... I have an input textfield named "a1", a dynamic text field named "levrai", and a small textield named "cl" with a blink symbol inside ( â–ˆ )

When i write a text in the a1.text, it's automatically duplicate in the levrai.text + the super blinking cursor . And then the real cursor is not visible because it's a dynamic textfield... it's cool !!

var m:String = "";

var mBlink:String = "â–ˆ";

var numOfBlinks:Number = 0;    //5;

var speedBetweenBlinks:Number = 400;

var blinkOn:Boolean = false;

var t:Timer = new Timer(speedBetweenBlinks,0);

t.addEventListener(TimerEvent.TIMER, setBlink);

t.start();

function setBlink(e:TimerEvent):void{

    if(blinkOn)

    {    cl.text = m;

        blinkOn = false;

        levrai.text = a1.text + cl.text;

    } else {

        cl.text = mBlink;

        blinkOn = true;

        levrai.text = a1.text + cl.text;

    }

}

but it give me another question that i will write in another subject, about focus... because in my project, a1.text is not "visible" finally ; i will see it later...

Votes

Translate

Translate

Report

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