Make the cursor to stay next to the last character

  • Una conectada
  • Born
  • Born
  • No Avatar
  • Joined: Nov 30, 2012
  • Posts: 2
  • Status: Offline

Post November 30th, 2012, 8:04 am

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
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post November 30th, 2012, 8:04 am

  • Zealous
  • Guru
  • Guru
  • User avatar
  • Joined: Apr 15, 2011
  • Posts: 1202
  • Loc: Sydney
  • Status: Offline

Post December 2nd, 2012, 3:59 am

is there any more information you can add like source code samples or more detailed problem.
  • Una conectada
  • Born
  • Born
  • No Avatar
  • Joined: Nov 30, 2012
  • Posts: 2
  • Status: Offline

Post December 3rd, 2012, 9:55 am

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
  • No Avatar
  • Joined: Jul 06, 2010
  • Posts: 280
  • Status: Offline

Post December 17th, 2012, 12:42 pm

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 100 times

  • ScottG
  • Proficient
  • Proficient
  • No Avatar
  • Joined: Jul 06, 2010
  • Posts: 280
  • Status: Offline

Post December 17th, 2012, 1:04 pm

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 95 times

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 94 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
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.