Dynamic sliders numero 2
Posted by Helmut | Filed under Tutorials
Title: Dynamic Sliders Numero 2
After working with the previous version of the sliders -se previous post-. I had the opportunity to "upgrade" the sliders since there was a slight chance that the sliders had to react to only one button rather than two as originally planned. Needless to say it wasn't required to apply this update but it came out nice. Once again there was no need to update anything in the class but just 2 extra lines of code.
//Dynamic Sliders
Posted by Helmut | Filed under Tutorials
So I was working on a project where we needed some sliders, it was basically the same slider but in different sizes and positions. So today I was sitting there just wondering how I could make this more dynamic, and just put a small class together and created a small sample. Updating the sliders the way they were originally created took a long time but allowing the sliders take the parameters dynamically it took seconds to update.
Here is the sample and feel free to play with it
Actionscript count and trace the number or arguments passed to a function
Posted by Helmut | Filed under Flash Bits
- var totalArgs = arguments.length;
- trace("Number of Arguments passed = " + totalArgs);
- for (var i:Number = 0; i < totalArgs; i++) {
- trace ("Argument "+i + ": " + arguments[i]);
- }
Actionscript Round and keep decimals function
Posted by Helmut | Filed under Flash Bits
- function formatDecimals2 (num, digits) {
- if (num < 0 ) {
- num = 0;
- }
- if (digits <= 0) {
- return Math.round(num);
- }
- var tenToPower = Math.pow(10, digits);
- var cropped = String(Math.round(num * tenToPower) / tenToPower);
- trace("digits:" + digits + " - " + cropped);
- }
- formatDecimals2( 35435.234234, 2);
- formatDecimals2( 35435.234234, 3);
- formatDecimals2( 35435.234234, 4);