A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: how do i animate input text box??

Hybrid View

  1. #1
    Junior Member
    Join Date
    Nov 2004
    Posts
    27

    how do i animate input text box??

    I have a simple flash contact form on my website, I would like to have the input box light up or change color whenever someone clicks inside that box to type in information, once they click into another the box goes back to the way it was and the other lights up?? I have seen this done a million times, just wondering how i do it for myself

    thnx in advance

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    You'd have to put a box behind your input box, and do a onSetFocus action on the textbox.

  3. #3
    Junior Member
    Join Date
    Nov 2004
    Posts
    27
    onSetFocus?

    could you give me an example code to put in box?

    thnx

  4. #4
    Monkey Moderator Lexicon's Avatar
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2,038
    Try browsing the Actionscript Language Reference in the help files. You will find other ways you can change your input textbox other than background and border colours as below.

    This will work if you place this code on a frame when the inputbox is on screen and in the same timeline and it's <instance name> is "myTxt". No need to have anything behind your inputbox.

    code:

    myTxt.onSetFocus = function(){
    this.backgroundColor = 0xFF9999;
    this.borderColor = 0xFF0000;
    }
    myTxt.onKillFocus = function(){
    this.backgroundColor = 0xFFFFFF;
    this.borderColor = 0x000000;
    }

    www.lexicon-design.co.uk
    If we aren't supposed to eat animals, then why are they made of meat?
    If Vegetarians like animals so much, why do they eat all their food?

  5. #5
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    Whoops, I guess I didn't realize you could do it on the box itself. Looks like you have to click the "Show border around text" button to make it work, though.

  6. #6
    Junior Member
    Join Date
    Nov 2004
    Posts
    27
    hmmm, still not working correctly I added the code, but it stays white until clicked, I am curious how it works with a box underneath, perhaps that will work a little better, or you can provide an fla with the text box code in place, i may have screwed it up, doh..

    thnx

  7. #7
    Monkey Moderator Lexicon's Avatar
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2,038
    You can set the colours up beforehand so it is the right colour to begin with.

    place this code on a frame when the input text box first appears on screen....

    code:

    // initial setup
    myTxt.border=true;
    myTxt.background=true;
    myTxt.backgroundColor = 0x9999FF;
    myTxt.borderColor = 0x000000;

    // on focus actions
    myTxt.onSetFocus = function(){
    this.backgroundColor = 0xFF9999;
    this.borderColor = 0xFF0000;
    }
    myTxt.onKillFocus = function(){
    this.backgroundColor = 0x9999FF;
    this.borderColor = 0x000000;
    }

    www.lexicon-design.co.uk
    If we aren't supposed to eat animals, then why are they made of meat?
    If Vegetarians like animals so much, why do they eat all their food?

  8. #8
    Senior Member mal pacino's Avatar
    Join Date
    Jul 2003
    Location
    England - and it's going down the pan!
    Posts
    996
    Hey thats great lexicon

    Oh by the way dope - hello

  9. #9
    Registered
    Join Date
    Aug 2000
    Posts
    69
    i was also wondering how to do the fading effect...? plz can u guys guide me..? whn i click on the textfeild it shud fade out a color.

  10. #10
    Senior Member mal pacino's Avatar
    Join Date
    Jul 2003
    Location
    England - and it's going down the pan!
    Posts
    996
    this is for cybersip

    This file was created by gparis on this forum - perhaps dope might make use of it too - it does the fading thing using a movie clip behind the text field

  11. #11
    Junior Member
    Join Date
    Nov 2004
    Posts
    27
    thnx fellas

    whatssss uppp mal!!!

  12. #12
    Registered
    Join Date
    Aug 2000
    Posts
    69
    thanx mal.

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