AS3 Focus

12 2 29th 2009 § 1 comment § permalink

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 = "";
  }
};

Where am I?

You are currently viewing the archives for 12 2 29th 2009 at DrPunchBlog.

  •  

    December 2009
    M T W T F S S
    « Nov   Jan »
     123456
    78910111213
    14151617181920
    21222324252627
    28293031  
  • Archives

  • The Uber-Mannerist ...
    By Van Arno
  • RSS mtr.me

  • Translator