Actionscript 3.0 :: Display The Zeros When The Time Gets Under 10?
Apr 27, 2010I need it to display the zeros when the time gets under 10.I can't seem to make it work.
package com.aqua
{
import flash.display.Sprite;
[code].....
I need it to display the zeros when the time gets under 10.I can't seem to make it work.
package com.aqua
{
import flash.display.Sprite;
[code].....
developing custom video player for my fla files.. i made few flash slides with combination of audio,text,animations, and video files.(for a e learning project).. the player which i made is a blend of few sample tutorials available on online... now my problem is how to display the total movie length of the movie in a dynamic text box using as2..
View 6 RepliesI have to make time so the hours to be starting with 0 for the numbers less then 10 for example 9:30 to be 09:30 and in my code it works for the minutes but not for the hours. I have written the following code here:
function UpdateClock () {
myDate = new Date ()
hours = Number(myDate.getHours())
minutes = Number(myDate.getMinutes())
seconds = Number(myDate.getSeconds())
[Code] .....
Is it possible to remove zeros from the end of a value? For example, i have an output value of 2200 kb but i want it to convert to 2.2 mb. Can this be done using actionscript 2.0?
Also, how could i check the value of the number and display the correct symbol?
Im returning the time as a string from a function like so
return minutes + ":" + seconds + ":" + millisec;
But I need each part to always display with two digits and show leading zeros.
I'm trying to find a way to manipulate an array; well, two, actually, but I suspect one solution will fix both.
I have an comma-seperated string of numbers pulled from an xml file, that correspond to the correct answers in a multiple-choice exam app I'm working on. The numbers will always appear low to high, but there could be any number of them up to a maximum of 10, for example:
1,3,5
2,3,5,7,8
1,2,8,9,10
I've seperated the list out into an array, but what I'm eventually going to need to do is to compare this array with another array containing the user's answers. The array of their answers won't necessarily have the same number of values as the array of correct answers.
So, I'm thinking one way round this would be to add zeros in between the numbers in each array, so that they will both have the same number of values. To re-write the example arrays above, these would be manipulated to:
1,0,3,0,5,0,0 (for 7 possible answers)
0,2,3,0,5,0,7,8,0 (for 9 possible answers)
1,2,0,0,0,0,0,8,9,10 (for 10 possible answers)
I can then follow the same process for the array of user's answers (which could be almost anything, but will be limited to the maximum number of responses, i.e. 7 for the first array in the above list), and then run a function to compare the two arrays, which will, after adding the zeros, have the same number of values.
I've made several attempts at this, but keep getting tangled up in loops and if statements... I'm not exactly an Actionscript ninja, as you may have guessed by now!
how I can approach the above, or know of an existing script that will do what I'm after?
How to fix date to retrieve minutes/hours with zeros ?
E.g. it's 05:09 AM >
trace(_date.getHours()+":"+_date.getMinutes()); //5:9
But I want 05:09 instead of 5:9 - so how to add zeros?
var _date = new Date();
_min = _date.getMinutes();
//fix date:
var _str:String = _min.toFixed(1);
_min = Number(_str);
trace(_date.getHours()+":"+_date.getMinutes());
= 5:9 ....
F8as2-
Background:
Currently I have to use two different text fields to display 10000 due to the different font sizes.
The 10 is a larger font and the 000 is a smaller font. When I assign '0 'to the dynamic text fields of the smaller font I get just that a '0' not a '000' which is what I want.
Question:
Is there an easy way to display leading zeros in a dynamic text field? Or can a dynamic text field have different character positions displayed in different font sizes? or both?
I'm modifying someone's old AS 2 Flash application and I need to pass numeric data in as a string OR have a properly formatted USD currency string in the end.
Currently, I might pass something like Data1=$34,000.00&Data2=$12,344.18&etc...
in via FlashVars. Assuming I show Data1 in a dynamic input field, I'd get something like "$34,0"
I'm not too concerned whether this is a super clean, proper solution or a functional hack-like solution with this application. It's needed, but only for a short time.
I have an input text field that is named in the properties box as 'numberOfKids'. When the program is executed, and a delete or backspace is pressed the input textfield goes blank and any calculations that use 'numberOfKids' shows NaN.I have trapped the NaN and undefined so that a numeric 0 shows up instead of a blank.
First problem: The cursor is to the left of the zero, so the first number inputted by the user is 10x larger than what they want. 0 becomes 10. How do I get the cursor to move to the right of the 0?
Second Problem: When I manually move the cursor to the right of the 0 and input a number, say 4, it shows up as 04. How do I delete the leading numeric zero in the input textfield?
Here's the code I am using:
calculateChildWeight = function () { if (isNaN(numberOfKids)) { numberOfKids = 0; } if ((numberOfKids) == undefined) { numberOfKids = 0; } if (numberOfKids>=0 && numberOfKids<=137) { numberOfKids = numberOfKids; } else { numberOfKids = 0; } if (isNaN(adjustedChildWeight)) { adjustedChildWeight = 0; } if ((adjustedChildWeight)=undefined) { adjustedChildWeight = 0; } adjustedChildWeight = Number(numberOfKids*(-100)); //numberOfKids.setSelection(numberOfKids.length, numberOfKids.length); //if (numberOfKids.length=2 && numberOfKids<10) { // remove the first character or leading zero// numberOfKids = numberOfKids;// }};
I am loading a flv video in AS2:
var conexion:NetConnection = new NetConnection();
conexion.connect(null);var stream:NetStream = new NetStream(conexion);
mi_video.attachVideo(stream);
stream.play("motto.flv");
this.onEnterFrame = function() {
[Code] .....
It works very good, In this line, I get de current time of the flv:
timer_txt.text = ((integer.length<2) ? "0"+integer : integer)+":"+((decimal.length<2) ? "0"+decimal : decimal)
And I need to display the total time too. By the way, I am not using the any flv component, I need to play the video in a custom player....
How can I display the timecode when using the flvPlayback component and custom skin?
View 1 RepliesI am having trouble getting my time to display correctly. Everything works great apart from 12pm display as 12am.this is my function that runs in a setinterval.
PHP Code:
[code]...
So I have recently been looking everywhere for the as3 equivalent of how to display the current time in non military format? I have searched the forums, nothing really comes up.
View 1 RepliesI have a dynamic text box set up called 'circle'. Each time the movie loads I want it to display different text.
Currently, I have
Actionscript Code:
_root.circle="hello","nice to see you", "hello, again";
on the timeline.
Unfortunately, when it loads it just sticks with the first 'hello', instead of choosing one of the other options. How can I tell flash to display a different text option each time?
How to create some action script that will display either an image or a SWF based on the time of day ie. Day and Night and the seasons ie. Winter, Summer, Spring, Fall.
I know it has something to do with creating a file that is .as and making sure you have the correct class Id. Looked at a few tutorials on creating calenders and image galleries but can not figure out how to combine the two to just show the image or SWF.
I have a problem with reseting time of displaying a picture when user click button to next/previous picture.
ActionScript Code:
stop();
time = setInterval(nextpicture, 7000);
[code].....
how to display seconds in my Date/Time display. right now I have Year, month, day, Hours and minutes displaying. But my Seconds are showing up undefined.
Here is my code...
function howlong(arg) {
if (length(arg)==1) {
arg = "0" + arg;
[Code]....
I need this to work so that on my stage i can have a dynamic text box displaying the current time of the flv and the total time ---- example 3:45 / 6:58 where the 3:45 would update as the flv was scrubbed or played, or whenever a jump point was pressed. I found an example of this on this page.I have been using the as3 code to import my video and use cue points and for the life of me I cant get this to work.
View 14 RepliesDoes anyone know a script that can display the time elapsed on a site like this http:[url].... i took a look at the countdown timer tutorial but it's not what i'm looking for ...
View 14 Replieshow to display a random number every time i need to display 3 digit random number display and i has also a random number display for 3 dec place too
View 2 RepliesBy default, when you visit a website that is made entirely in Flash and there is a Tme and Date movie clip feature... you know... it gets the current time and date of your computer so you're actually seeing your own time, right? What I've always wanted to do is when you visit a website that is made entirely in Falsh, and you have a Time and Date movie clip that tells the creators current time and the current date instead of just getting the values of your computer time and displaying your own. I'm in the Philippines so I want the visitors of my site to view what time and date is it in the Philippines.
View 14 RepliesI'm makking a simple flash player which loads movies as the songs.The song file is simply a preloader then in the next scene one frame which plays the song.I would like to know how I can have a display which shows the song time.
View 1 RepliesI am working on an application to display GMT time and CST time in a swf. I am able to make the clock display time in GMT. When I check for time in CST it seems to be 1/2 hour behind. I am bit confused and code is junk now (So not up in the forum).
View 2 RepliesI am developing an application to display different time zones. Class works fine only once, later it fails to update the movie with dials of clock. I not sure what could be the issue, I am using delegates as methods weren't called previously.
[Code]...
I have a movie clip and i would like to display its duration in minutes and seconds.urrently I am displaying the frames so it shows "frame 320 of 500" etc.I would like to figure out how many frames in the movie clip and convert it to time so in the end it will display: 1:23 / 3:00
Code:
frameNumber = "frame " + getProperty(movie, _currentframe) + " of " + getProperty(movie, _totalframes);
[code]......
How do I make the date and time if its less than 10 to display a zero in front so for example like four o six and and six seconds looks like this 04:06:06 instead of this 4:6:6. Also how do you do this with a date I want a date have only 2 digits for the year and if the month and day are less than 10 to display a zero in front of them...
View 4 RepliesI was wondering, how do I display text for like 2 seconds or something, then make it disappear?Another question is, how do I set a timer that prevents a function from running within a time limit (2 seconds again) after it ran? Like if a function is triggered by a Key_DOWN, what would a code be to prevent it from running again until that 2 seconds is up? This question is for a 'reload' in a shooter. Is there any other way to approach this?
View 14 RepliesI've got this code that displays the time but, I want the time to display dynamically, updated by the user's sytem clock so it always displays the "current time".
myNow=new Date();
myDay=myNow.getDay();
myMonth=myNow.getMonth();
myDate=myNow.getDate();
[code]....
I retrieve a date and time form a mysql db through php and display it on my AS3 page in a dynamic txtfield but it also displays the xml tags, so it looks like this:
<date>Saturday 14.10 Time: 13.00</date>
How do I display this without the tags?