|
-
Input text box problem:O
Hey all!
I'm glad I found this forum cuz I'm having a problem with this.
I've made an input text box (var: password) and put this code inside a seperate MC:
onClipEvent (enterFrame){Selection.setFocus("_root.password");
Selection.setSelection(length(password), length(password));
}
The problem is that after 9 letters or numbers have been typed in the input text box the "|" stops at the same spot in the text box and when trying to type another letter this get's on the wrong side of the "|" and the more I write the more this gets pushed further to the right. Like this:
testingth|gnihtsi
Here I tried to write "testingthisthing". As you can see after 9 letters it starts pushing the next thing I write to the right instead of leaving it behind and moving the "|".
I hope someone could solve this, I'm not a very experienced programmer so don't insult me or anything if this is very easy to solve.
Thanks,
Dan
-
Code:
onClipEvent (enterFrame){
Selection.setFocus("_root.password");
Selection.setSelection(length(password), length(password));
}
I'm not sure where everything is defined. but I notice that here you have _root. before password once, but not the other times. I don't use setFocus alot, but i've noticed that with most functions if the input is a variable, you normally don't have quotes. Quotes normally signify strings. So I think setFocus might be thinking your setFocus is not on _root.password, but on "_root.password?"
Maybe...
Code:
onClipEvent (enterFrame){
Selection.setFocus(_root.password);
Selection.setSelection(length(_root.password), length(_root.password));
}
this is a weird error, thoguh. Maybe i'm wrong about what I've said, let me know, otherwise try it.
P.S. place code in [ CODE ] [ /CODE ] tags (without the spaces).
-
Correction to the Above: after googling setFocus, the "" ARE supposed to be there. so perhaps just the _root's missing made the difference?
Code:
onClipEvent (enterFrame){
Selection.setFocus("_root.password");
Selection.setSelection(length(_root.password), length(_root.password));
}
-
Thanks for such a fast response!
Yeah this is a wierd problem I had. But just seconds ago I managed to solve it.
Instead of
Code:
Selection.setSelection(length(password), length(password)); }
I changed it to
Code:
Selection.setSelection(100,100);
}
The earlier code told the input text field to allow the length of the word "password" to be functional. But since I'm not using some kind of registration where users get passwords that isn't needed.
Thank you for your help anyway!
Dan
-
Oh, that makes perfect sense in retrospect. I'm glad you were able to solve it. Stick with the forums!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|