A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: how to test change in textbox

Hybrid View

  1. #1
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    how to test change in textbox

    I'm trying to solve this little problem

    I have a value in a text box and I want to process the number using the previous value with the new value, but I want to do it without the user having to push a button.

    I tried setting the old value to a variable on onSetFocus then in the onChanged used it, this works so long as the user leaves the textfield before changing the value again. In other words if the user already changed the Value and then backspaces and changes it again I cannot get the value before change.

    Code:
    myshutter.onSetFocus=function(){
    	oshutter=Number(myshutter.text)
    	txt2.text=oshutter
    	
    	}
    myshutter.onChanged=function(){
    oshutter=Number(myShuter.text)
    txt1.text=shutter(myshutter.text,oshutter)
    temp=shutter(200,180)
    //	var temp=shuttter(Number(myshutter.text),oshutter)
    	if (choice._currentframe==2){
    		//get new tstop
    		stop.text=Number(stop.text)*temp
    		}else{
    		//get new fps
    		}
    	}

  2. #2
    Steve R swrzzzz's Avatar
    Join Date
    Jan 2005
    Location
    Leicestershire,UK
    Posts
    195
    You could add a listener to it and watch for all the key presses, but it depends how many digits the number is as to how easy that would be to parse (you may get 1/2 a number)

    It would be easy to read the number on a CR like that I think

    Steve

  3. #3
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    longest the number would be is 3 characters range is 11.2 to 180

  4. #4
    Steve R swrzzzz's Avatar
    Join Date
    Jan 2005
    Location
    Leicestershire,UK
    Posts
    195
    but if someone clears , say, 139 down to 1 and then starts adding characters ( a 2 then a 5) how do you know he is finished - for example is it 12 or 125?

    Timeout?

    I think listening for a carriage return and then reading the field may be your best substitute for a button.

    Steve

  5. #5
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Steve you point out exactly some of the problems I've been dealing with. I'm thinking I might change that field to a combobox as the selections are limited to certain options.

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