How to change border color of input textbox?

  • DartHead
  • Beginner
  • Beginner
  • User avatar
  • Joined: Feb 22, 2004
  • Posts: 56
  • Loc: NYC
  • Status: Offline

Post February 22nd, 2004, 4:22 pm

I am trying to create an input textbox that changes its border color when focus is given to it, like the search field on Macromedia's website in the upper left: http://macromedia.com/

Can anyone help? I'm using MX.

Tx!

Lance
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post February 22nd, 2004, 4:22 pm

  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Joined: Jun 26, 2003
  • Posts: 1402
  • Loc: Philadelphia, PA
  • Status: Offline

Post February 22nd, 2004, 9:56 pm

Well the macromedia.com site was done in Flash MX 2004, and every site i've seen that uses components from that version has this green border look (I can't say as I like it too much). I believe this is on by default, but im not sure since I don't use that version.

In Flash MX however you can use something like this...

Code: [ Select ]
//set your input textfield to have a border
myInputBox.border = true;
//set default border color (in this case grey)
myInputBox.borderColor = 0x999999;
//when textfield is focused
myInputBox.onSetFocus = function() {
    //change the border color to red
    this.borderColor = 0xFF0000;
};
//when focus is taken off of text field
myInputBox.onKillFocus = function() {
    //reset the border back to original grey color
    this.borderColor = 0x999999;
};
  1. //set your input textfield to have a border
  2. myInputBox.border = true;
  3. //set default border color (in this case grey)
  4. myInputBox.borderColor = 0x999999;
  5. //when textfield is focused
  6. myInputBox.onSetFocus = function() {
  7.     //change the border color to red
  8.     this.borderColor = 0xFF0000;
  9. };
  10. //when focus is taken off of text field
  11. myInputBox.onKillFocus = function() {
  12.     //reset the border back to original grey color
  13.     this.borderColor = 0x999999;
  14. };
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 23403
  • Loc: Woodbridge VA
  • Status: Offline

Post February 22nd, 2004, 10:01 pm

That's very interesting. Fisrt time I even noticed it. THanks for the post (and the answer lostinbeta) -- I'll hav to remember this one.
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
  • DartHead
  • Beginner
  • Beginner
  • User avatar
  • Joined: Feb 22, 2004
  • Posts: 56
  • Loc: NYC
  • Status: Offline

Post February 23rd, 2004, 6:05 am

Thanks lostinbeta! That's exactly it.
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Joined: Jun 26, 2003
  • Posts: 1402
  • Loc: Philadelphia, PA
  • Status: Offline

Post February 23rd, 2004, 8:13 pm

Glad I could help :)
  • DartHead
  • Beginner
  • Beginner
  • User avatar
  • Joined: Feb 22, 2004
  • Posts: 56
  • Loc: NYC
  • Status: Offline

Post February 24th, 2004, 9:42 am

It was the onSetFocus that I couldn't figure out. Here is what I did with your code. It's not much, but it's a cool 5-cent effect.

http://lancemonotone.com/inputbox.htm

http://lancemonotone.com/inputbox.fla

Thanks again.

Lance
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Joined: Jun 26, 2003
  • Posts: 1402
  • Loc: Philadelphia, PA
  • Status: Offline

Post February 24th, 2004, 10:23 am

Good Stuff... i'm glad to see you took the original concept and expanded on it to make your own thing. To be honest that is VERY rarely seen from people asking for help.
  • DartHead
  • Beginner
  • Beginner
  • User avatar
  • Joined: Feb 22, 2004
  • Posts: 56
  • Loc: NYC
  • Status: Offline

Post February 24th, 2004, 11:21 am

Thanks. I'm trying to learn as much as I can. I'd be lost without the Flash community. I appreciate having people like you out there.
  • MayconSouza
  • Born
  • Born
  • No Avatar
  • Joined: Oct 23, 2004
  • Posts: 1
  • Status: Offline

Post October 23rd, 2004, 5:45 pm

Hi, this is very interting, but i try do this in a comboBox, and i don´t have sucess...

Can you help me?

Tks
MayconSouza

Post Information

  • Total Posts in this topic: 9 posts
  • Users browsing this forum: No registered users and 51 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.