Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Seconds Only...



Im trying to make a countdown to a certain date, but making a variable that displays a variable of all time left in seconds only...

I have the following script

var year = 2003;
var month = 03;
var day = 05;
var data1 = new Date(year, month-1, day);
function CountRetro() {
data2 = new Date();
difSec = Math.floor((data1-data2)/1000);
sec = difSec%60;
difMin = Math.floor(difSec/60);
min = difMin%60;
difHours = Math.floor(difMin/60);
hours = difHours%24;
days = Math.floor(difHours/24);
count = days*86400+hours*3600+min*60+sec;
countermov.count = days*86400+hours*3600+min*60+sec;
}

but it goes funny every so often - can anyone please point out where I'm going wrong please???!!!!

Cheers
Bombadier



FlashKit > Flash Help > Flash ActionScript
Posted on: 02-11-2003, 12:40 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Timer Seconds Aren't Seconds On Fast Connection?
On my flash site at
http://www.yogashanti.com
there is a timer which displays my random quotes for arund 20 seconds, but on fast connections woooooah!

How do i resolve this without setting the seconds to a looong length of time (which would mean on dial-up connections each quote will be there forever.

I hope i made it clear what the problem is - sorry if it seems un-clear.

Many thanks in advance

Cesca

How To Start A Sound At X Seconds And Stop At X Seconds?
I'm trying to figure out how I can make the sound file that I load into Flash start at x seconds and end at x+30 seconds.

So basically, I just want a 30 second sample to play starting at a specific time position. Does anyone have any advice on how to do this or have links to somewhere I can read up on it?

As always, thanks for any help

-Ind

Convert Seconds To Minutes:Seconds
Hey guys,

I am currently using the following code to display the secconds of a FLV being played:


ActionScript Code:
time_txt.text = Math.round(_root.video_mc.videoZ.playheadTime*100)/100;

I need to change this to display MM:SS (minutes:seconds) rather than just seconds and decimals.

Any idea how I can do this?

The javascript people here at work suggested something like this:


ActionScript Code:
function strPad(str, places, pad, side) {
while (length(str) < places) {
if (side == "left") str = pad add str;
else str = str add pad;
}
return (str);
}
time_txt.text = Math.floor(_root.video_mc.videoZ.playheadTime / 60) add ":" add strPad(_root.video_mc.videoZ.playheadTime % 60, 2, 0, 'left');

Any help would be lovely.

Thank you!

Scott

Minutes And Seconds From Seconds
Hi

I have a video player and trying to make a time indicator of minute and seconds.

I got fairly close, however it started to count backwards

Anyone got a script? Thanks

Converting "seconds" To "minutes:seconds"
I'm trying to add a running timer to my flash movie. I've got it now so that it counts seconds (by comparing _currentframe with the frame rate), but I'd like to be able to express that in minutes:seconds.

Anybody have a nice script that can do that?

Converting "seconds" To "minutes:seconds"
I'm trying to add a running timer to my flash movie. I've got it now so that it counts seconds (by comparing _currentframe with the frame rate), but I'd like to be able to express that in minutes:seconds.

Anybody have a nice script that can do that?

All I Need Is To See The Seconds
My first post: try not to be too brutal.

I am attempting to make a * digital clock *...

here is my code...

time = new Date();
seconds = time.getSeconds();
minutes = time.getMinutes();
hours = time.getHours();
if (seconds<10) {
seconds = "0"+seconds;
}
if (minutes<10) {
minutes = "0"+minutes;
}
if (hours<10) {
hours = "0"+hours;
}
if (hours>12) {
hours = hours-12;
}
time_field = (hours+":"+minutes+":"+seconds);


^^^^ time_field is the name of my Dynamic text field on the stage..


I just want to know how to get the seconds to *tick*. Right now, the code just encounters the script and stops... no incrementing of the seconds..


Thanks in Advance.
rhina--->

Dup MC After X Seconds
I'm trying to duplicate an MC every 1000 milliseconds...can I get sum aid with a code please...thanx alot...

Thanks everyone...

After 5 Seconds Next Pic?
What i want to do is after 5 seconds go to next pic, and keep repeating. How would i go about that? Thanks

Ten Seconds
Good day! I am creating another quiz. I create an input box so the user can input the answer. If it takes him ten seconds to answer, the computer will supply the correct answer. Should I use setInterval()? Thank you in advance for those who can help me

Gone In 60 Seconds
I have a scene that I want to last for 60 seconds, then jump to "Scene 2" frame 1. I've looked at something, but I don't really know if I'm on the right track. Help is much appreciated

Here's the timercode:

ActionScript Code:
var myTimer:Timer = new Timer(60000, 0); // 60 seconds
myTimer.addEventListener(TimerEvent.TIMER, runOnce);
myTimer.start();

function runOnce(event:TimerEvent):void {
    gotoAndPlay(1, "Scene 2");
}

How To Get A Value From Php After Some Seconds?
Hello,
Does someone know how to do the following thing?

I want to read a value from a php file with this method :

request.method = URLRequestMethod.POST;

But when you do this, the php file is excecuted and the variables will be read.

But what if you have a check in your php and after a few seconds the php will send a value to flash.
How do you retreive this value without executing the php file again? Or is it normal to execute this again?
I really don't know.

I remember in AS 2.0 you could do something with:

onEnterFrame = function() {
loadVariablesNum(mailform, 0);
if(_root.action = "go") {
gotoAndPlay(20);
delete this.onEnterFrame;
}
}


But in actionscript the are many eventhandlers, but i could not find something that will
scan for the value ? Does anyone have an idea to do this in actionscript 3.0?































Edited: 05/15/2008 at 01:02:58 AM by Michealnl

How To Pause For A Few Seconds
Is there anytway to get the script to pause for a few seconds.. and then go on with reading the rest??

I tried fooling around with do while ... but everything just locks up

any help is apreciated... thanks

dizy

Seconds Between Frames
I like to get the number of milliseconds starting on a frame(not the first frame !) till it gets to another frame.

example:

I want the number of milliseconds from frame 10 to 20

I tried to do it with gettimer() but that only gives me the milliseconds of when the mainmovie started although I attached the code to a submovie that didn't start on frame 1 of the timeline of the main movie...

I'm confused !!

AttachMovie For No.of Seconds
hi
does anyone know how I can attach a movie for a certain amount of seconds and then have it removed?

thanks in advance

Pause For 5 Seconds
Hi, i'm tring to count 5 seconds befor i go to next command, is this script right?

it doesn't work... :-(

pauseDuration = 5000;
startTime = getTimer();
lapsedTime = getTimer()-startTime;
while (lapsedTime<pauseDuration) {
lapsedTime = getTimer()-startTime;
}


Thanks in advance,
Maya

How Do I Pause An MC For A Few Seconds?
I'm sure I can pause a movie for a few seconds using getTimer, but I can't figure out how! Does someone have a simple script for this?

Thanks in advance.

An Action Every Four Seconds? Please Help
I am trying to make a flash movie that counts to four seconds and then resets to zero.

or

a counter that every four seconds, performs an action (but I don't know how to begin to tell it to do it that way) but if you can do it this way easier it will work.

or put simply, how do i get an action to occur every four seconds?


here is the code i am working with now, but I got it from a timer movie here at FK so it does some stuff I don't need it to (like format minutes, etc.)

("minfeild" is the minutes text field and "seconds" is the seconds text field on the stage)

millitime = getTimer()/60000-(int(getTimer()/60000));
seconds = (int(millitime*60));
mymin = (int(getTimer()/60000));
if (Number(mymin)<1) {
mintime = "00";
} else {
mintime = (int(getTimer()/60000));
}
minfield = mintime;

How To Count The Seconds In An MC
Hello Everyone,

Does any one know how to make a counter that counts the seconds in a movie clip. I would like to know how many seconds a movie clip will run for and I would like to count the seconds that have passed as it runs. How can I do this.
Thank you all in advance.

Countdown In Seconds?
Is it possible to make a countdown to an action in seconds? If it is, how?

Wait For 2 Seconds
I have a button in a movie. When it is pressed it uses the 'get URL' command to hyperlink to another page. I wish for it to wait 2 seconds, then hyperlink upon being pushed.

How do I do this?

Thanks

Pause For X Seconds
Hi,
Very sorry for the long post but.....

I posted this earlier but without any luck, I've been working on it for a full day now but I can't figure it out.

What I want to do is:

Have a frame where I want to pause the movie for 5 seconds or so before it carries on to the next frame.
I can't work it out to save my life, any help would be greatly, and I mean greatly, appreciated.

As an added bonus, can you hold on a frame until theres an interaction, ie.

hold on frame until keypress 'space'?

or something similar, I'm an absolute actionscript newbie so I'd love any help.


thanks in advance

Danny



<Copy of part of previous post>

>Hi,

>I usually use director for my multimedia but have started to try and learn a bit about flash.

>For a loop in director I just use the library behaivour loop for X seconds then jump to marker name ''

>Is it possible to do this in Flash MX and if so how. I'm sure these are easy ones for all you gurus so I'm sorry to waste your time but I can't figure it out at all

>I've tried the following code but to no avail.

>var x = 0;
>setInterval(myfunc(),480);


>function myfunc() {
>if(x==0) {
>stop();
>x++;
>}
>else {
>gotoAndPlay(45);
>clearInterval...
>}
>}
>Thanks, I have tried this, I had to take the ... from the end of clearInterval to get it to run, again it pauses the movie but then refuses to carry on.
>I also tried changing the clearInterval line to

>clearInterval(myfunc(),480);

>again with no luck.

>Any more help you can give would be greatly appreciated.

>One newbie going completely out of his mind.....

Countdown In Seconds
Hi!

I want to make a countdown for my site.. I found a little actionscript but i think that i can't make a longer countdown with this.. the counter has to be able to count down a couple of days in seconds..

myDate = new Date();
seconds = myDate.getSeconds();
minutes = myDate.getMinutes();
hours = myDate.getHours();
seconds2 = 59-seconds;minutes2 = 59-minutes;hours2 = 23-hours;
if (length(minutes2) == 1) { minutes2 = "0" + minutes2; }if (length(seconds2) == 1) { seconds2 = "0" + seconds2;}timetil12 = (hours2+":"+minutes2+":"+seconds2+" left until 12AM");

My english is a little bit bad but i hope you know what I mean..

Thanx.

Kroontje

Frame Per Seconds
Hey All,

Nice Web site. I was wondering if anyone knows if there a way to change the fps(frame per second) in a frame. Example: For the first ten frames, I want them to be 12 fps. Starting at the eleventh one I want it to change to 25 fps. Is there a way because with the frame per second window (Document propreties) allows you to change it for the whole project (Document) .

Thx for reading

Pause For 2 Seconds...
Is there any way to give actions to a button so that it will perform the task after two seconds. For example, I want a button, when clicked, to first open a movieclip and then after two seconds, open another movie clip..

Is there any way this can be done??

thanks.

Html: Get Url After Few Seconds?
Can someone tell me how can I make a HTML to link to another html after a few seconds?

Pause After A Seconds
i want to pause a movie or to trigger a movieclip after some seconds have been elapsed.
any idea of how to do that with actionScript?

thanks!

May I Have 30 Seconds Of Your Time?
Hi! I am new to doing flash movies, but I managed to make a little one. I have put it on a website, and I can see it from my computer, but I am wondering if others can see it also.


Would you mind taking a look at this site, and letting me know via reply to this thread if you can see the flash movie on the page?

www.servusrecords.com/indexgrid.htm

Thank you

Pause For 3 Seconds
Is there a way I can pause the entire timeline for a set amount of time? I'm not using any movie clips.

A Few Seconds Of Your Time
I just uploaded the skeleton of my site.... http://home.insightbb.com/~containment2/realsoon.html

I was wondering if you can tell me whether it shows up well, and what you think of the layout of it. I'm concerned about the font really, whether other's will see it or not.

I'm currently building the content, mp3 player/selector (so the background sound will be in flash), preloader, and a couple of animations.

If you have any little mp3 players that you wouldn't mind hooking me up with, feel free to send it my way. All I want is play, stop, switch track, and maybe a small ticker telling what it is.

Or if you have any cool, scan line or other animations, I'm looking to do that as well.

I'll give full credit.

Thanks for your time.

Stop For 10 Seconds
can anyone give me the code to make the movie wait on a frame for 10 seconds before moving on to the next frame.

many thanks in advance

30 Seconds Of Your Time?
Hi,
I;ve just revamped my website, but one friend here in Australia said that it takes forever to download. It should play a simple animation while home page loads, but for her it didn't.
Please click on this link, & please just report whether the animation plays within an acceptable length of time - no longer than 10 seconds.
Thanks for your time in advance.
Cat.
http://www.catscomix.com

Help: N Seconds In A Certain Frame
How can I make Flash wait for n seconds (i.e. 30) before continuing to next frame? I am trying to show a certain image/movie during a song and then at another point of the song it will go to a different frame with a different image/movie in it. Thanks.

Load New .swf After 5 Seconds
Hi.

I wonder if it is possible to make a function where you have a series of .swf´s and make them load in an endless loop controlled by somekind of timer? The timer doesn´t have to be visual.

I would appriciate any help

Integer To Seconds
maybe i am going about this the wrong way, but im trying to do this quickly

theres this game that i am supposed to track how long someone was playing and display it on the screen

my current technique is using the setInterval for 1 second to add one to a counter
but how can i quickly format this to appear on the screen as 1:12?

i was looking into the date function a little, but it seems a little heavy to convert an integer into a time format

any suggestions?

thanks

Sopping For Few Seconds...
Is there a way to stop at a Keyframe for like a few seconds instead of using frames?

If so, can somebody post how? Thanks.

Inactive For 30 Seconds
I have a simple flash - cube. When I click on button, cube generate number.
Now, I want to do this >
1/ i click on a button
2/ button generate number and will be disabled for 30 second

when i click on button between 0-30 seconds my clicks will be blocked.

actionscript will count only first click and then do an action, disable button for 30 seconds and after 30 seconds, this button will be enable.

how can i do it ?

sorry for my english a still learning :)

and second problem

i have an actionscript and i want to run it at 5pm, it is possible ?
ofcourse, pc is running and flash too, but flash will be stopped until 5pm.
how can i do this condition ?

Seconds Timer
Hi, im trying to make a game and when the timer gets to 0 it will go and play a different frame could someone help me out please?
and im using Macromedea Flash MX 2004.

How Can I Pause For A Few Seconds?
I have an animation.

At the end of the animation, I want to pause for a small amount of time.

And then, I want to carry on with the next animation.



What's the best way of doing this in Actionscript?



Thanks.





OM

Seconds In Flash
I've got a problem. I made a kind of a preloader bar that takes variable number of seconds to fill up. Now i've done it like this:


Code:
onClipEvent(load){
//framerate = 20 fps
_root.duur = _root.time * 20;
_root.init_breedte = this._width;
_root.breedte = _root.init_breedte / _root.duur;
this._width = 1;
}
onClipEvent(enterFrame){
if(this._width < _root.init_breedte){
this._width = this._width + _root.breedte;
}
}

It determines the width of the bar, determines what amount of px it has to be wider each frame and then ads that amount to the bar every frame.

The problem is that on each computer you take a look at it, the number of seconds (for instance 10) aren't of the same length. On some slower computers it takes 11 seconds.

How can I solve this problem (possibly via milliseconds or something???)?

Thanks in advance

Move Along X Every 5 Seconds
Hi all, Im working on a website and id like to have my site always doing something so its not a boring static page. So if you can help me out i would really apreaciate it. Beleive me this will not be going to waste.


heres a screen shot of what i want to happen.
I want the logos movieClip to move to the right every 5 seconds or so to display a different logo.

Thanks alot!!!

Please Help Me (it Will Prob Take You 60 Seconds)
............but it has taken me the best part of two days. I am currently helping a friend get her business off the ground, and offered to do the site for her, as I enjoy dabbling in sites for family members etc. Unfortunately she bought a template that she really liked, and has asked me to sort it for her, I have changed all the html, but it has flash buttons, and I literally dont know where to start, I even had to buy Flash MX, as I dont want to let my mate down. PLEASE HELP.......all I want to happen is for the five different buttons (although they seem to be movie clips) to link to aboutus.html services.html solutions.html products.html and contacts.html I am certain that someone who knows what they are doing (not me thats for sure) will be able to configure the menu in about 60 seconds. I have even uploaded the fla file to my old school website, for anyone to keep if they desire to http://www.moorsidehigh.co.uk/menu.fla If you are able to help me, that would be fantastic, and would save me an awful lot of embarrasment, any posts below on how its done would be greatly appreciated.

How To Get Seconds From Time A To B
How can I get the amount of seconds from today, up to a certain given date?
I tried a couple things, but it did not get me very far:-(

I've tried this, but to be honest I am not sure if this is the amount of seconds up untill that date:
var playdate = new Date(2006, 5, 9, 18, 0, 0, 0); // 2006-06-09 18:00
var todayDate = new Date();
diff = (playdate - todayDate)/1000;
trace (diff);

Execute Every 3 Seconds
Hi,

How can I get some code to execute every 3 seconds?

I tried to define a static variable to get the start time and then I can start from there, but it kept returning errors.

Any help will be very much appreciated.
Thanks

What's The Best Way To Get Something To Happen Every X Seconds?
Can someone tell me how to get something to happen every X seconds?
For example, for a function to get executed.

I'd like an Actionscript way of doing this.

The way I'm doing it is having a call to a function after 100 frames, fro example and just looping this.

Thanks.


OM

Wait A Few Seconds Before Doing Something?
Hi,

I have this code right now that makes the background move when a button is pressed. I would like to make it wait 3 seconds before moving the background when a button is pressed so that my swf's exit animation finishes first. Can someone please tell me how to do this?


Code:
_root.currMovie = "home";
container.loadMovie(_root.currMovie+".swf");

bgTargetX = 42;
bgTargetY = 117;
onEnterFrame = function(){
backGround2._x = backGround2._x - ((backGround2._x-bgTargetX)/16);
backGround2._y = backGround2._y - ((backGround2._y-bgTargetY)/16);
}
newsbutton.onPress = function(){
bgTargetX = -648;
bgTargetY = 117;
}
homebutton.onPress = function(){

bgTargetX = 42;
bgTargetY = 117;
}
personnelbutton.onPress = function(){
bgTargetX = -1338;
bgTargetY = 117;
}
studiosbutton.onPress = function(){
bgTargetX = -2028;
bgTargetY = 117;
}
contactbutton.onPress = function(){
bgTargetX = -2718;
bgTargetY = 117;
}
Thanks, Matt

[F8] Autoplay After A Few Seconds
Hey,

I would like to have my movie automatically perform this function:


Code:
navi.vor.onRelease = function() {
nextFrame();
nostop = 1;
video_mc.onEnterFrame = function() {
if (nostop == 0) {
delete this.onEnterFrame;
} else {
this.nextFrame();
}
};
};


As I am using a button for play/pause, this should work like this:

If I press on play, a variable
Code:
(autoplay = 1;)
gets set. This should make the movie perform the function, after a wait time of a few seconds.

Any help is greatly appreciated...

Play AFTER 5 Seconds
Hi all

I tried to play the flash after 5 seconds
but this code does not work


Code:
stop();
var n=5000;
var intervalID=setInterval(play(),n);

can any one help me please


Thank's

[F8] Controlling Swf By Seconds.
Hey this is probably really easy to do but I haven't done any flash in probably over a year so I'm pretty rusty. Is there a way to tell a swf file to stay on screen for a certain amount of seconds and then to unload? I know I could create lots of frames in the swf file to acheive this but I am looking for a more elegant solution. Thanks.

Copyright © 2005-08 www.BigResource.com, All rights reserved