Make the cursor to stay next to the last character

  • Una conectada
  • Newbie
  • Newbie
  • Una conectada
  • Posts: 5

Post 3+ Months Ago

Hello friends.

When we introduced some characters in a text box for input in Flash MX 2004 Professional and click outside the text box lose focus. By the time I managed to regain focus in the same text box, but which had already introduced characters I selected. What I want is that the focus on the text box that is active, but the cursor appears to the next can be recovered to the last character we have introduced, so that we can continue with the introduction of text.

Can someone help me?

Many thanks in advance.

To greeting
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Zealous
  • Guru
  • Guru
  • User avatar
  • Posts: 1240
  • Loc: Sydney

Post 3+ Months Ago

is there any more information you can add like source code samples or more detailed problem.
  • Una conectada
  • Newbie
  • Newbie
  • Una conectada
  • Posts: 5

Post 3+ Months Ago

I understand that it can be somewhat confusing. It is a little difficult to explain. When you enter text in a box as input text, appears a flashing cursor always after the last character we have introduced (such as when I'm writing now). Well, in Flash when we click outside the box that we're writing, the cursor disappears, what I want is be able to reset the cursor to your position so that we do not lose focus and we can continue writing.

I hope that it is clearer now.

Thank you very much again.

A greeting.
  • ScottG
  • Proficient
  • Proficient
  • ScottG
  • Posts: 457

Post 3+ Months Ago

In Action Script 3 you could do this
ACTIONSCRIPT Code: [ Select ]
stage.focus = instanceName;
 
  1. stage.focus = instanceName;
  2.  

This will restore the cursor to its last position before the the text box lost focus.

If you still wanted it to be at the end you could then do
ACTIONSCRIPT Code: [ Select ]
instanceName.setSelection(instanceName.text.length, instanceName.text.length);
 
  1. instanceName.setSelection(instanceName.text.length, instanceName.text.length);
  2.  


If you need it in Action Script 2 I'd have to get back to you on that it's been awhile since I've coded in AS2
Attachments:
test.zip

(6.05 KiB) Downloaded 154 times

  • ScottG
  • Proficient
  • Proficient
  • ScottG
  • Posts: 457

Post 3+ Months Ago

In Action Script 2 it would be something like
ACTIONSCRIPT Code: [ Select ]
Selection.setFocus(instanceName);
Selection.setSelection(instanceName.text.length, instanceName.text.length);
 
  1. Selection.setFocus(instanceName);
  2. Selection.setSelection(instanceName.text.length, instanceName.text.length);
  3.  
Attachments:
test2.zip

(6.82 KiB) Downloaded 151 times

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 16 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.