I’ve got a falling ball with many variables (“gravity”; “bounce”; “drag”; etc). How can I create a way to have my viewers change the variable amounts by physically typing in a number when they view the movie? I’ve got a “++” and “–” button, but those only seem to change the ball’s variable while in motion. And as it takes about one second for the ball to fall, that’s kind of pointless. Basically, I want an effective way for my viewers to play with the variables of a falling ball. And speak slowly, I am very much a novice at AS.
Okay, I don’t have flash in front of me, so bear with me. You can create an input textbox on the stage with the text tool. Give it an instance name, like “speedtext”
Okay, now, script this in the actionscript window for the textbox “speedtext”:
[AS]_global.speedvar = this.text;[/AS]
Now, put a button next to the textbox, give it an instance name “speedbutton” and code it as follows:
then, on the ball movie clip, give it an instance name of “ball”, and put a stop() action in the first frame of the movie. Then, put all your ball manipulation code in the second frame, and make sure that when you declare your variable “gravity” it is outside of the onClipEvent(enterFrame) tag. It should work then, I think. Post your .fla or code if you want a more complete answer.