A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: textField question...

  1. #1
    Senior Member
    Join Date
    Nov 2007
    Posts
    207

    textField question...

    I have a text field that is a search input which searches lists in an accordion...there are three lists in my accordion...but only two have a search function...the text field is disabled and grayed out when the 3rd list is the open tab in the accordion...and I have an instructional string that displays in the search text field when the user switches tabs...such as "Type an exhibitor name" and "Type a booth number"...so the user knows what to type in the text field...but as it is now, you have to select that text, and delete it(or start typing when its all selected)...but what i want is the text to disappear when you click to activate the text field...so when the user wants to type, they click the text field to give it focus, and the words disappear automatically...I had though to put the text field in a movieclip...then when the mc gets clicked (if the words match either of those captions, then clear the text field...but I cannot figure out how to type in the text field that is inside this new mc...

    I have a text field instance name search...within an mc called sF on the stage...

    code:

    var accHandler:Object = new Object();
    accHandler.change = function()
    {
    if(listAcc.selectedIndex == 0)
    {
    sl._alpha = 100;
    sF.search._alpha = 100;
    sF.search.type = "input";
    sF.search.text = "Type an Exhibitor Name";
    sF.search.backgroundColor =0xffffff;
    sF.search.selectable = true;
    }
    else if(listAcc.selectedIndex == 1)
    {
    sl._alpha = 100;
    sF.search._alpha = 100;
    sF.search.type = "input";
    sF.search.text = "Type a Booth Number";
    sF.search.backgroundColor =0xffffff;
    sF.search.selectable = true;
    }
    else if(listAcc.selectedIndex == 2)
    {
    sl._alpha = 40;
    sF.search.text = "N/A";
    sF.search.type = "dynamic";
    sF.search.backgroundColor =0xDDDDDD;
    sF.search.selectable = false;
    }
    }

    sF.onPress = function()
    {
    if(sF.search.text == "Type an Exhibitor Name" || sF.search.text == "Type a Booth Number")
    {
    sF.search.text = "";
    }
    }



    any easier way of doing this?

  2. #2
    Senior Member
    Join Date
    Nov 2007
    Posts
    207
    Sorry every1 I should have done some more searching...

    code:

    search.onSetFocus = function()
    {
    if(search.text == "Type an Exhibitor Name" || search.text == "Type a Booth Number")
    {
    search.text = "";
    }
    }


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center