txtField Focus IN Focus OUT Issue
hey guys,
i'm working on desktop app , trying focus_in , focus_out work way want it. have far:
var defaulttext="enter names here" txtnames.text=defaulttext txtnames.addeventlistener(focusevent.focus_in,function(){txtnames.text=''}); txtnames.addeventlistener(focusevent.focus_out,function(e:focusevent){ e.currenttarget.text=(e.currenttarget.text=='')?'enter names here':e.currenttarget.text;});
it works fine. problem once enters data txtnames want data remain, if clicked off , clicked in. right now, if put data in, click off (data stays) when click in . . . oh let's modify entered, entire data entry removed on tf entry.
any ideas?
thanks!
you should not build functions listener have done. them separate , refer them name in listeners.
the reason lose what's in textfield having event handler function assigning them empty...
function(){txtnames.text=''}
maybe rid of focus_in listener begin , decide want have happen when focus obtained.
More discussions in ActionScript 3
adobe
Comments
Post a Comment