Forums: Flash:

 

setFocus woes (AS2)

first
 

JERKSTORE setFocus woes (AS2)

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

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

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

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.gif ...no idea really on that.

 

JERKSTORE

Nope, neither of those worked frown

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 smile

 

Storm

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.

 
first
 

Forums: Flash: setFocus woes (AS2)

 
New Post
 
You must be logged in to post