TwelvestoneFlash

setFocus woes (AS2)


Sign in

  • Waiting for Godot ( 730 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 5.1 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.9 k posts )
    general front end design an...
  • Back End ( 9.7 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
JERKSTORE
 
2009-06-26

Is it just me, or is flash not capable of setting focus to a blank field?

If I try and set focus to a field with a value of "" then focus reports as being set, but there is no cursor and I'm unable to type in the field. However, if the field has a value of at least one character then it works fine.

WTF?

Storm
 
2009-06-26

What Flash Player version are you testing in?

Is it "" as in empty text field on the stage or "" as in an empty String var that has been assigned to the text field

tf.text = emptyString;

?

JERKSTORE
 
2009-06-26

I'm using 10,0,12,36 (Mac)

mcText.onSetFocus = Delegate.create (this, textFieldSetFocus);

private function textFieldSetFocus():Void{ mcText.text = ""; };

So my text field (created with AS) has a default value, and when the field gets focus, I want to clear out the default value.

But if I set it to be an empty String, then there is no cursor and no way to engage the field. However, if I set it to be ANYTHING but an empty field (mcText.text = "a"; ), it works fine, but then the field isn't empty and ready for input (which is the whole point).

Storm
 
2009-06-26

try:

var es:String;

mcText.onSetFocus = Delegate.create (this, textFieldSetFocus);

private function textFieldSetFocus():Void{ mcText.text = es; };

or

var es:String;

mcText.onSetFocus = Delegate.create (this, textFieldSetFocus);

private function textFieldSetFocus():Void{ mcText.text = es.toString(); };

and see what happens.

I've never used Delegate and it has been deprecated, so I am also wondering if it's a problem in the newest players. :shrug: ...no idea really on that.

JERKSTORE
 
2009-06-26

Nope, neither of those worked :(

I wouldn't really use Delegate by choice, but it seems to be the only way to do foo.onWhatever = function(){} in a class in AS2 and have it work.

I appreciate the help. Thanks Storm k

Storm
 
2009-06-26

same result right?

I just did this with AS3 but I'll think about it some more and see if anything else pops in my head tonight for AS2.

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneFlash

setFocus woes (AS2)