Just a really quick bit of code that hides “dummy” when textBox “txt” is clicked on.
I’m just posting this because I feel like I need to have more code related postings.
// set focus
txt.addEventListener(FocusEvent.FOCUS_IN, hideDummy );
txt.addEventListener(FocusEvent.FOCUS_OUT,showDummy );
function hideDummy( e:Event )
{
dummy.visible = false;
}
function showDummy( e:Event )
{
if( txt.length == 0 ) dummy.visible = true;
}
And in AS 2:
txt.onSetFocus = function( oldFocus ) : Void
{
dummy._visible = false;
}
txt.onKillFocus = function( newFocus )
{
if (txt.length < 3)
{
dummy._visible = true; TF_question.text = "";
}
};

One Comment
thank you, ive been looking for a way to hide an object
Post a Comment