View Full Version : scrolling casino numbers, numerical values defaulting too small
Syllogism
03-02-2008, 02:17 PM
Hi All
I'm busy developing a casino-like counter. with the numbers counting up. I've gotten it to work pretty well, the problem though, is that when I add more numbers to the counter, the numbers with which they need to move becomes so small that flash seems to be defaulting to a certain value and this causes all the numbers past a certain point to all move at the same speed.
Is there a way to force flash to use really really small numbers? Or can anyone think of another way of doing this?
Have a look at the attached .fla to see what I mean.
Thanks
Syllogism
03-03-2008, 07:20 AM
anyone care to have a gander?
neilmmm
03-03-2008, 09:46 AM
can you post a flash 8 version? can't quite picture what you mean
Syllogism
03-03-2008, 10:06 AM
oh, sorry, here you go:
http://www.jmurray.co.za/casino/start.fla
http://www.jmurray.co.za/casino/numberRunner.as
you can see it here:
http://www.jmurray.co.za/casino/start.fla
Syllogism
03-03-2008, 10:11 AM
when I trace out the values that the numbers should move by, I get different values, but when they move they move at the same pace...
numberHolder8 should move by 6e-6
numberHolder7 should move by 0.00006
numberHolder6 should move by 0.0006
numberHolder5 should move by 0.006
numberHolder4 should move by 0.06
hmmmmn....
Syllogism
03-03-2008, 10:28 AM
So I guess what I have to do it have an if statement that checks whether the number is a certain size. if it isn't it adds the number to a variable which then gets checked everytime until it reached the pre-rewquizite size and then the move is made...
I don't suppose anyone know what the smallest number is that flash will move a number by?
neilmmm
03-03-2008, 11:36 AM
thank you
it will be very nice ...
i think your problem is floating points and , if it is Math.pow should help
i will try and have a better look later
Syllogism
03-03-2008, 12:03 PM
Well! I've solved the problem, it's not very elegant, code-wise, but it works...
What I did was check if the number was below a certain value, if it was, I didn't move the number I added the value to a variable, then I checked that variable and when it was over that value the movement was allowed and the variable reset to 0. The problem now is that the way I have implemented the scrolling of the numbers is to make three of the movieclip's, position them on top of each other and then check their x position, if it's over 2/3rds it resets it to zero and you have seamless scrolling, The problem is that with this approach when it goes really fast you're always going to be over the 2/3 mark so it's always sitting at the zero position.
if(this._y > (this._height / 3) || this._y < -(this._height / 3)){ /// controls position of thumbnails
this._y = 0;
}
Anyone know and alternate way of seamless scrolling?
Syllogism
03-03-2008, 12:04 PM
Well! I've solved the problem, it's not very elegant, code-wise, but it works...
What I did was check if the number was below a certain value, if it was, I didn't move the number I added the value to a variable, then I checked that variable and when it was over that value the movement was allowed and the variable reset to 0. The problem now is that the way I have implemented the scrolling of the numbers is to make three of the movieclip's, position them on top of each other and then check their x position, if it's over 2/3rds it resets it to zero and you have seamless scrolling, The problem is that with this approach when it goes really fast you're always going to be over the 2/3 mark so it's always sitting at the zero position.
if(this._y > (this._height / 3) || this._y < -(this._height / 3)){ /// controls position of thumbnails
this._y = 0;
}
Anyone know and alternate way of seamless scrolling?
you can see it in action here:
http://www.jmurray.co.za/casino/start.fla
http://www.jmurray.co.za/casino/numberRunner.as
http://www.jmurray.co.za/casino/start.html
|
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.