A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Selection.setFocus() - not showing cursor

  1. #1
    Senior Member
    Join Date
    Dec 2006
    Location
    Jax, FL
    Posts
    110

    Selection.setFocus() - not showing cursor

    Hello,
    Need to understand how the cycle of events occur on a single frame movie clip. Could someone give me a brief summary of what happens when I have a movie clip with two text boxs and two buttons.
    The first button clears the boxes and second button sets focus to first text box, and set the text to 'home'.

    The text in the first box is briefly selected and then the highlighted selected text disappears, but the text 'home' remain in the box and my focus says I'm in the first box, but I don't see a cursor in the first box. I understand the movie clip is cycling through it's events. But what events I'm not clear on.
    If anyone can expand on the events occuring it would be a great help.

    Simple action script:
    btn1.onPress=function(){
    txt1.text='';
    txt2.text='';
    };
    btn2.onPress=function(){
    Selection.setFocus("_root.txt1");
    txt1.text='home';
    }

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Not ignoring you, just haven't figured it out.

  3. #3
    Junior Member
    Join Date
    Jan 2008
    Posts
    1
    Hi,
    if you want to see the cursor at the end of the word 'home' try this:

    Code:
    btn1.onRelease = function() {
    	txt1.text = '';
    	txt2.text = '';
    }
    btn2.onRelease = function() {
    	txt1.text = 'home';
    	Selection.setFocus("_root.txt1");
    	Selection.setSelection(_root.txt1.text.length,_root.txt1.text.length);
    }
    Last edited by kutyamutya; 01-06-2008 at 06:55 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center