ActionScript 3.0 :: Display Empty Decimals In Timer?
Nov 12, 2010I wonder if there's a more straightforward way to achieve this.[code]...
View 3 RepliesI wonder if there's a more straightforward way to achieve this.[code]...
View 3 RepliesI have a text field that displays a number from a variable. How can I make it so this number is always formatted to 2 decimal places?
For example, 1 would be changed to 1.00 and 1.5 would be 1.50, etc.
I have a issue.. I want to display the score as a whole number without decimals, anyone know how this can be done?
the relevant code:
ActionScript Code:
public static const SCORE_PER_APPLE:Number = 1;
public static const SCORE_MULTIPLIER:Number = 1;
private var score:Number;
[Code].....
So yeah.. it displays every decimal. Is there a way to round up the numbers, or not displaying anything less than a whole number?
An onLoadProgress listener object is returning a variable I am using to tell the user what percentage of the movie has been loaded. I am happy with the results of
Code:
myListener.onLoadProgress = function(empty10MC:MovieClip, loaded:Number, total:Number):Void{
//setText();
var percent:Number = loaded/total*100;
loadingTxt.text = beginTxt + percent + endTxt;
however the number returned is like 15 digits long! Is there any way I can limit the variable to display only 1 or 2 decimal places?
I don't know if i am saying it right, but i want to take out(empty?) a display object properties.Instead of manuallyQuote:
trace(displayObject.x);
trace(displayObject.y);
trace(displayObject.width);
[code]......
Is there a simple way to completely empty a display object container regardless of what it contains, including if it's already empty? In other words, without determining its children and using removeChild on each?
View 2 Replieshow in Flex can I display a message within a Spark List component that states that the List is empty. For example if I have a List showing number of jobs outstanding, if my List is empty then I want a message displayed across the List stating "there are no jobs to perform".
I'd rather not use an Item Renderer because then it's an Item (the list is not empty) and the item can be selected.
In the documentation for DisplayObject, it states that the width and height of the DisplayObject can not be changed if it is empty. Why is this restriction necessary? In every other framework I have used, you can resize containers that are empty.
View 2 Repliesmy code: myTextBox.text = count1.currentCount.toString();
How would i display the current count in milliseconds?
I have been working on a flash game for the past couple days and it is my first major game so there have been alot of issuesI think I finally have everything figured out with a few exceptions , they are.1. The movie clip that serves as my pop up window is popping up behind all my moving icons.I need it over top of them obviously.2. I need to figure out a simple way to pause time while the pop up is up and resume time when it disappears.3. I need to add about 5 seconds to the game clock when the user shoots a question mark so that it appears as though the clock was stoppedonClipEvent (enterFrame) {if (_root.time == 30) {_root.speedz = 9;_root.intervaln = 30;}if (_root.time == 10) {_root.intervalz = 10;}if (_root.time ==0) {_root.gotoAndStop(3); }}
View 1 Repliesim using real basic code for a small game and ive got a timer set up on one room and cant get it to display in the endgame room.this is the code i used
var gameStartTime:uint;
var gameTime:uint;
var gameTimeField:TextField;[code].....
I have an animation of footprints being left on the ground as if by an invisible man or ghost. the animation consists of:
1 movieclip containing --> 5 footprints each one is an individual movieclip. Each print fades in and out using the Tween class with an alpha effect
The main timeline uses the following code to create random instances of the animation:
var myTimer:Timer = new Timer(12000);
myTimer.addEventListener("timer", timedFunction);
myTimer.start();
[Code].....
so it looks like the function is being called correctly and removing the first instance of FOOT from the stage. but the 2nd iteration generates the error. Is this is a problem with the timer? I would like to send this to someone for examination and assistance.
How do I make it so that my timer does not display the decimal places when it increments by .10? I only want to see whole numbers...
View 6 RepliesI am making a game where I want to have a timer running over each level (a total of 4). When the user has finished the game, I want the timer to stop and then display their time. I have 2 dynamic text boxes with the varibles set to them as "Seconds" and the other as "Min". Here is the ActionScript I have for it right now:
[Code]...
I'm on the last stage of developing my game, and I need to display a countdown timer, lasting 3 minutes. I want to display the time counting down in the format "3:00" and then when the timer hits the full 3 minutes an event is fired and it stops, and I display a few other things along with it in the same function. The difficulty I have is actually doing the bit where I display the timer and update it accordingly. If there is any genius out there who can do this (In AS3) then you are my new best friend. I only have a few hours till my submission deadline, and this thing is KILLING ME!!! hypothetically.
View 6 RepliesI'm building a simple audioplayer. In frame 1 I have:
Code:
mySound = new Sound();
songs = new Array("1.mp3", "2.mp3");
songIndex = 0;
mySound.loadSound(this.songs[songIndex], true);
mySound.start();
var playing = true;
[Code] .....
So, the sound begins to play from the beginning. However the problem is with the timer: when 'stop' is pressed it says 0:00. But, when I press play again it immediately jumps to the time it showed when stop was pushed, e.g. 0:12
I've been asked to make a flash countdown timer. I want to use a dynamic text field to display the numbers, but have a few buttons that go with them. I want to be able to press the button, and a set time is generated in the dynamic txt field, i.e. 10 minutes, 15 minutes & 30 minutes. The idea is that the user will press 30 minutes, then start, then the countdown will commence, and same for the other time increments.
View 3 RepliesI know how to remove all decimals with:
ActionScript Code:
Math.round (xTwo*0.39);
But, how do I keep 1 or 2 decimals?
Can I use a decimal in a variable name in AS2? I need to create a variable named SCC.Q2.
View 4 RepliesI have a list of 99 item (something like a phone book) and I will like to sort them in different method. Part of the 99 item might be empty, so the requirement is to move the empty field behind the sorted data in every sorting behavior, here the code we have so far:
[Code]...
I have made a class for handling colors with decimals.It's not really impressive i think, but i made it because i needed something like this in my game: in the normal interpolateColor function of Color if you do: color1: 0xFFFFFE color2 0xFFFFFF and progress = 0.8, then the tint will be 0xFFFFFF, whereas with my class it will be 0xFFFFFE, and store a value of 0.8 for blue, so that the next time it is interpolated, that 0.8 will be taken into account.it then only needs a 0.2 to jump to 0xFFFFFF.Look especially at the last function, thats what the class is about.[code]....
View 2 RepliesIn AS3, from a division I get a number like this one: 0.9130406010219044.Is there any way to reduce the number of decimals (aside from multiplying that number for one million)? Is there a way to reduce the numbers BEFORE the division is performed?
View 5 RepliesOne more thing that I need for my calculator:
how do I turn the decimals into whole numbers if the number is:
10.56 I want my number to be 11
10.49 I want my number to be 10
these numbers are inside an input field.
As the title, is there a class method in Flash to limit and round of a number's decimals ?Like :roundToTwoDecimals(1.2362 ) = 1.24
View 8 RepliesI'm trying to do a pretty simple modulo equation but i'm getting a weird return.0.03 % 0.01I was expecting there to be no remainder, so the answer would be 0. However the return flash gives me is: 0.009999999999999998If I bump everything up to whole Numbers it works just fine: 3 % 1 = 0However I know eventually I'll be doing something like 3.4 % 1 and I'm concerned that at that point I'll run into this same issue.
View 4 RepliesI'm working on some banners in various sizes and I noticed that I can only enter a font size in full pixels but not in decimals. I can type them in but noting happens to the size.
View 1 Replieswhy it is not simple! i just want to restrict input text to allow only number with 2
[Code]...
how can i make it with actionscript 2.0 ?
I've this problem with rounding up. My problem is more complex than i describe here but I'm sure i can figure out the rest myself once I got this working. I want flash to round up with two decimals at all time.
[Code]....
I faced a strange problem today while adding some decimal number in AS3. I have simply adding trace(1.025 + 0.025); statment. It didn't returned proper output i.e. 1.05., instead it has given as 1.0499999999999998.
know the reason behind this. Actually we are calculating some angle and leng in geometric function.And we are getting some diffrence in calculation.
Two questions concerning the numericStepper component and I think they both have to do with how to access the textfield part of the component.
1. How do you change the color of the textfield border in the numericStepper component.
2. I'm using the numericStepper to step up/down by increments of .25 (25 cents) and would like it to always show 2 decimals. But when it reaches a whole number (like 25) it will not show the 2 decimals. Do I treat this like a textfield to force the text to have 2 decimals? And if so, how do I access the .text?