moosildinho
10-21-2008, 10:31 AM
Hey!
As you will very soon realise, I am VERY new to ActionScript 2.0. Basically, a friend and I are ultimately designing a site to host calculators for specific needs (mostly physics). So, to kick-off my learning, I thought i would start with the most basic physics; acceleration. I have tried to design a calculator where the user puts in values for initial velocity, final velocity and time, and receive a value for acceleration (of course after pressing a "calculate" button). It's simple, but it's a start. Anyway, so far I have made 'Input' fields for the Initial/Final velocity as well as time, made a 'dynamic' field for the acceleration to be displayed in, a button to initiate a calculation, and some basic lines of script. When I try to run the calculator, nothing happens on pressing the 'calculate' button. Here is the script so far:
{calc_btn.onPress = function (calculate);}
function calculate (event.onPress):void;
var acceleration:String
var time:String
var initial:String
var final:String
time = t.text
initial = initial.text
final = final.text
{
if (time!="") and (init!="") and (final!="") {
acceleration.toString = ((((parseInt(final)) - (parseInt(initial))) / (parseInt(time)))
} else {
acceleration == "error";
}
}
If anyone has any idea what i am doing wrong, any help would be GREATLY appreciated. I'm sure there are a lot of bracketing errors, and the script probably looks like illegible crap to you, and if so, any advice would be awesome.
Thanks in advance.
EDIT: sorry for putting this in the wrong section before, should have looked around a bit more first :(
As you will very soon realise, I am VERY new to ActionScript 2.0. Basically, a friend and I are ultimately designing a site to host calculators for specific needs (mostly physics). So, to kick-off my learning, I thought i would start with the most basic physics; acceleration. I have tried to design a calculator where the user puts in values for initial velocity, final velocity and time, and receive a value for acceleration (of course after pressing a "calculate" button). It's simple, but it's a start. Anyway, so far I have made 'Input' fields for the Initial/Final velocity as well as time, made a 'dynamic' field for the acceleration to be displayed in, a button to initiate a calculation, and some basic lines of script. When I try to run the calculator, nothing happens on pressing the 'calculate' button. Here is the script so far:
{calc_btn.onPress = function (calculate);}
function calculate (event.onPress):void;
var acceleration:String
var time:String
var initial:String
var final:String
time = t.text
initial = initial.text
final = final.text
{
if (time!="") and (init!="") and (final!="") {
acceleration.toString = ((((parseInt(final)) - (parseInt(initial))) / (parseInt(time)))
} else {
acceleration == "error";
}
}
If anyone has any idea what i am doing wrong, any help would be GREATLY appreciated. I'm sure there are a lot of bracketing errors, and the script probably looks like illegible crap to you, and if so, any advice would be awesome.
Thanks in advance.
EDIT: sorry for putting this in the wrong section before, should have looked around a bit more first :(