PERFECTO!

Thanks Amol,

For anyone who might want this. I have made a script that will read the length of a text field and display the number of characters left while someone was typing. The reason for the code I was seeking with this request was because the code previously would eat up a lot of memory. It made my computer fan run wild if the form sat in my browser.
Now it does not thanks to Amol.  :))

Here is the code competed. Again, it is as2, but would love to see an as3 conversion.
I might get to that later, but welcome any comers.

//commentxt_mc is the textfield name, 650 is the number of characters allowed. You will also want to set the text box max characters to this when creating your text box.
var numChar;
commentxt_mc.onSetFocus = function() {
   onEnterFrame = function() {
        numChar = 650 - commentxt_mc.length;
        if (numChar == 0) {
                maxChar = "Max Characters Reached";
        } else {
maxChar = "Max Char: " + numChar.toString(); //Have another text box with the var maxChar to display the results while typing.
        }
   }
};
commentxt_mc.onKillFocus = function() {
  onEnterFrame = null;
};

Best,

Karl


On Jun 15, 2010, at 1:34 AM, Amol wrote:

Hi,

use set fouse  for text ,

sample_txt.onSetFocus = sample1_txt.onSetFocus = function ()
{
   this.border = true;
   this.borderColor = 13683368;
   this.background = true;
   this.backgroundColor = 13683368;
};
sample_txt.onKillFocus = sample1_txt.onKillFocus = function ()
{
   this.border = true;
   this.borderColor = 0;
   this.background = true;
   this.backgroundColor = 0;
};


Regards amol




----- Original Message ----- From: "Karl DeSaulniers" <[email protected]>
To: "Flash List" <[email protected]>
Sent: Tuesday, June 15, 2010 9:51 AM
Subject: [Flashcoders] Text area focus


Hello,
I have a text box or area on a form that I would like to know when a user has put the cursor in it or not. Wither it has focus or not. I am working in AS2. Please don't grit your teeth too much :-)
For some reason I am not able to get the focus of my text area.
Anyone have this code in their scrap files?.. lol
TIA
Karl DeSaulniers
Design Drumm
http://designdrumm.com
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Karl DeSaulniers
Design Drumm
http://designdrumm.com

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to