Hi guys,
Still loving your work and was wondering if someone could help me out a bit here. I am writing a small game and have a limited knowledge of AS2 but all seems to be going well and thankfully I am nearly done. I have one major issue mind. I have a section which allows the player to place bets on a horse, these are represented by plus and minus buttons for each horse (of which there are six). The problem I have when you click on one quickly it does not always update, it is like there is a lag between them.
On MouseDown seems to work well but I have found that if I use this event handler it fires all of the mc instead of the one I want, so I have reverted back to old school.
You will have to excuse the crudeness of the code, I am experimenting but here it is
onEnterFrame = function()
{
if (_root.raceStatus != "racing")
{
_root.bettingBar.add1.onPress = function()
{
if (_root.playerCash > 0)
{
stake1 = stake1 + 1
_root.playerCash = _root.playerCash - 1
}
}
_root.bettingBar.minus1.onPress = function()
{
if (stake1 > 0)
{
stake1 = stake1 - 1
_root.playerCash = _root.playerCash + 1
} else {
stake1 = 0
}
}
_root.bettingBar.add2.onPress = function()
{
if (_root.playerCash > 0)
{
stake2 = stake2 + 1
_root.playerCash = _root.playerCash - 1
}
}
_root.bettingBar.minus2.onPress = function()
{
if (stake2 > 0)
{
stake2 = stake2 - 1
_root.playerCash = _root.playerCash + 1
} else {
stake2=0
}
}
_root.bettingBar.add3.onPress = function()
{
if (_root.playerCash > 0)
{
stake3 = stake3 + 1
_root.playerCash = _root.playerCash - 1
}
}
_root.bettingBar.minus3.onPress = function()
{
if (stake3 > 0)
{
stake3 = stake3 - 1
_root.playerCash = _root.playerCash + 1
} else {
stake3=0
}
}
_root.bettingBar.add4.onPress = function()
{
if (_root.playerCash > 0)
{
stake4 = stake4 + 1
_root.playerCash = _root.playerCash - 1
}
}
_root.bettingBar.minus4.onPress = function()
{
if (stake4 > 0)
{
stake4 = stake4 - 1
_root.playerCash = _root.playerCash + 1
} else {
stake4=0
}
}
_root.bettingBar.add5.onPress = function()
{
if (_root.playerCash > 0)
{
stake5 = stake5 + 1
_root.playerCash = _root.playerCash - 1
}
}
_root.bettingBar.minus5.onPress = function()
{
if (stake5 > 0)
{
stake5 = stake5 - 1
_root.playerCash = _root.playerCash + 1
} else {
stake5=0
}
}
// Control 6
_root.bettingBar.add6.onPress = function()
{
if (_root.playerCash > 0)
{
stake6 = stake6 + 1
_root.playerCash = _root.playerCash - 1
}
}
_root.bettingBar.minus6.onPress = function()
{
if (stake6 > 0)
{
stake6 = stake6 - 1
_root.playerCash = _root.playerCash + 1
} else {
stake6=0
}
}
}
}