-
I want to create a math problem that the user inputs the data to be computed.
example:
220 - textinput = answer
I just started with scripting. I know Lingo fairly well and now trying to learn actionscripting.
Thanks
-
I think you would go about it like this.
Have an input text box named "textInput" . Then you can store the answer in a variable:
var answer = 220 - _root.textInput
//_root is wherever you have placed your text box, in this case its the main timeline.
dan
-
curmudgeon
name the input text box "textinput" in the "text options" pallette. draw a dynamic text box and name it "answer"
and add this script to a button:
Code:
on (release) {
answer= 220 -textinput;
}
-
Thanks
I'm working with now.
Is it possible not to have a button to generate the answer, rather as the user types in the "textinput" field. I want the answer to display automatically.
-
curmudgeon
yes, if you make the movie two frames long and add this code in the first frame of the main timeline
answer= 220 -textinput
the movie will constantly loop through the script as it loops through the frames
-
Ok, not sure whats happening.
Ok, here's what I got so far.
frame 1:
the user see's on screen
220 - "textinput" = answer
textinput & answer are invisible until something is typed in the "textinput" field.
However, when i used the code:
220 - textinput = answer; "220" is displayed where the answer should be. The real answer should be "185"
Sorry for my inability to understand this. In Director, I declare my varibles first, as in:
set varible textinput, answer
then write out the expression
220 - textinput = answer
Are their any simalarities with Lingo and Actionscripting?
-
curmudgeon
get shot of the quotation marks around the variable name otherwise flash interprets it as a string literal.
write your code in this order:
answer= 220 -textinput
because the answer equals 220 minus whatever textinput is
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|