Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple but difficult...

Status
Not open for further replies.

bobgg

Programmer
Joined
Jul 1, 2002
Messages
7
Location
GB
Hi everyone, I have a text box instance named:- inputbox1 set to input Text with a variable input1. I have also got the following code attached to the text box:-

onClipEvent(load) {
input1 = 0; // initialising the text box which worked
}

onClipEvent(mouseDown) {
input1 = ""; // clearing the 0 allowing the user to type
}

now what I wanted is to print out the value the user types
in, so I came up with this construct which does'nt work...

onClipEvent(mouseUp){
trace(input1); // dont work....
trace(inputbox1.input1); dont work.....
}

can anyone help??
BOB.G
 
So this is what's happening:

The user types something in the input box ... and you want to display what they have just typed, even though it's still in the input box ... ?
 
Umm? im not sure i really understand but whatever is in the text box is now equal to input1. so if you wanted to display it in a different text box lets say output1 you would just write input1 = output1 ? right?
 
bob.g,

the mouseUp event doesnt help coz when the user types in the numbers, that event wont happen. what u need is a keyUp event. Unfortunately, flash doesnt have that.

here's a work around. create an empty movie clip that monitors the value of input1. it can a 12 frame movie clip so that it checks every second (assuming u r on 12 fps) or a 6 frame movie clip, whichever u like. Make it display whatever is the value of input1 except 0.


that's what i could think of from my end.

hope this helped. if u need clarification, im right here.

biggie
 
Shenn, thanks for your help, I have got it sorted (fixed) now. I was over writing the value of input1 before displaying it.

thanks again....
BOB.G
 
Bignewbie, thanks for your idea, it seems interesting. however, for what I am doing, its not worth it. I am creating a simple calculator. while I am at it, do you know how to get flash5 to monitor the mouse and the keyboard at the same time. in english :- the user types in a value into a input box and then click the mouse. How can I give the user the option of using both the keyboard as well as the mouse.

BOB.G
 
well, Flash does have the onKeypress event, you can use that on your buttons.

 
I still don't understand why you have to go to all this trouble to display what the user types ... that's the whole point of an input textfield - it displays what the user types. You don't need any extra functions or constructs to show the input. But if you have it sorted then I guess I don't need to understand ... :)
 
rgstewart, basically the reason why I wanted to view the user's input is because I am trying to design a scientific calculator with more than one dislpay/window, so I wanted to make sure that the value submitted, is the value operated on. thanks for your intrest anyway, and I am sure I will hear from you again...

BOB.G
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top