Hi folks,
I've been leafing through the AS: Main tutorials, working my way through the tut's on Variables and the 'if' function etc. I'm an absolute newbie at AS, but I'm very interested in becoming fluent in it, even if it takes months and months (which I assume it will).
Anyway, seeing as I'm just getting to grips with the basics, I'm messing around with simple stuff like modifying the value of variables at the moment, but I've already hit a speed bump (it was bound to happen sooner or later!).
I'm trying to write a simple script that allows the value of a variable (an amount of money) to be changed with the use of two buttons (buy and sell) which will reduce or raise the amount of money.
I have the following AS on the main timeline, to initially set up the variables:
var myMoneyAmount:Number = 100;
var myMoney = "£"+myMoneyAmount;
var myMoneyDisplay = myMoney;
As far as I know, this part works fine. I have a dynamic text field on the stage, which shows '£100' exactly as I had hoped.
I then created a button object and created two instances of it, one with the variable name of 'buy' and one with 'sell' (which I'm not sure is actually necessary at this point... anyone?). The 'buy' button instance has the following AS attached to it:
on (press) {
myMoneyAmount -= 10;
}
and the 'sell' button:
on (press) {
myMoneyAmount += 10;
}
I know this is the most basic of basic, and doesn't even go beyond the skills of simple variables, but from what I've seen elsewhere in the BBS, people can be very helpful with stuff like this, and some people even seem to be tolerant of complete and utter newbies, so I guess I have a chance of getting some help :P
Please no messages like "another n00b didn't read AS: Main..." or whatever. I've read a bunch of stuff, and the Variable stuff I've read a number of times, I've just gotten a bit stuck and possible misunderstood something, or even missed something altogether.
Thanks a lot to anyone who can help! :)
(any extra tips or specific places to look with regards to this would be massively appreciated!)