jimnoy
10-22-2008, 12:24 PM
hi
im a total newbie to flash and i cant work this out. im sure its very simple though. id prefer to do it in actionscript 2.0 as 3.0 seems way to complicated. also id prefer clear coding for noob debugging (not necessarily the most elegant)
basically i want a program to take user inputs (numerical) from text boxes, store these inputs as variables, then rotate a symbol according to a function of time using these variables.
so far ive got an input text box called "textbox"
a movie clip symbol called "arm"
a button called "go"
so on opening, the arm should be static.
then user inputs a number into the text box.
then user presses the go button. the text box number should be stored as a variable w, and the arm should start rotating as per f=w*cos(t) (this is not actually the function im using, because my one is really messy)
im guessing the code should be something along the lines of
on (release) {
var w = textbox.text;
}
attached to the button "go"
and
var t=0
go.onRelease = function {
arm._rotation = w*cos(t)
t += 1/12;
}
this is obviously wrong, but you see what im driving at (hopefully). can anyone help me put it all together. should i be using more than one frame? i guess i should probably incorporate some kinda reset button too.
cheers in advance :)
im a total newbie to flash and i cant work this out. im sure its very simple though. id prefer to do it in actionscript 2.0 as 3.0 seems way to complicated. also id prefer clear coding for noob debugging (not necessarily the most elegant)
basically i want a program to take user inputs (numerical) from text boxes, store these inputs as variables, then rotate a symbol according to a function of time using these variables.
so far ive got an input text box called "textbox"
a movie clip symbol called "arm"
a button called "go"
so on opening, the arm should be static.
then user inputs a number into the text box.
then user presses the go button. the text box number should be stored as a variable w, and the arm should start rotating as per f=w*cos(t) (this is not actually the function im using, because my one is really messy)
im guessing the code should be something along the lines of
on (release) {
var w = textbox.text;
}
attached to the button "go"
and
var t=0
go.onRelease = function {
arm._rotation = w*cos(t)
t += 1/12;
}
this is obviously wrong, but you see what im driving at (hopefully). can anyone help me put it all together. should i be using more than one frame? i guess i should probably incorporate some kinda reset button too.
cheers in advance :)