View Full Version : Track Time Display
intravenus
08-16-2003, 12:06 AM
Hi guys,
here's a simple little script I wrote to make a time display for audio tracks,
//on frame 1//
tot = int(_root.audio._currentframe/30);
min = int(tot/60);
sec = int(tot-(min*60));
if(sec<=9){
sec="0" add sec
}
if(min<=9){
min="0" add min
}
Timer = min add ":" add sec (Timer is a dynamic text field)
//on frame 2//
gotoAndPlay(1);
this all works grand but does anyone have any idea how I would make the clock begin at the total time and count down?
All help very gratefully recieved.
Intravenus.
laughter
08-16-2003, 12:08 AM
hmm this swishmax or swish 2 ?
Schwalbach
08-17-2003, 12:33 AM
Hey, I don't know of a way to make swish read the audio to tell how long the audio is, but I could make a count-down for you, I think. Laughter, that is swishmax :)
dammitjanet
08-17-2003, 05:21 AM
Laughter, since Swish2 doesnt have any scripting per se, it is defintely SWISHmax, and since its in the SWISHscript help forum, that also makes it SWISHmax.
Intravenus, nice work, you could use _totalframes (_root.audio._totalframes) which when divided by your FPS should give you a total time. Remember it needs to be in Constant FPS mode, rather than Variable or none of those will work correctly.
intravenus
08-17-2003, 07:59 AM
Hey DJ,
thanks for the appreciation, I'm really REALLY new to Flashing and scripting so any praise from the gurus is priceless ;)
I tried using that FPS script you gave me and it was really weird because when tested, it worked the first time but refused to work after that, now it freezes the clock because the script can't find FPS.
Thanks for the help though.
Intra
For anyone interested, I found out how to make the clock count down instead of up,
simply change the tot variable. Check it out,
//on frame 1//
tot = int(_root.audio._totalframes/30)-(_root.audio._currentframe/30);
min = int(tot/60);
sec = int(tot-(min*60));
if(sec<=9){
sec="0" add sec
}
if(min<=9){
min="0" add min
}
Timer = min add ":" add sec (Timer is a dynamic text field)
//on frame 2//
gotoAndPlay(1);
dammitjanet
08-17-2003, 08:09 AM
Intravenus
if you have any issues at all, please post code or SWI's so we can help, thats what we are here for.
Stu
Damaso
08-20-2003, 02:29 PM
it's not working with me <_<
ERROR: Object name 'timer' is a reserved keyword and not allowed
Vincent26381
08-20-2003, 02:38 PM
Some variables can be seen by the flashplayer as a build in command. I think 'timer' is one of them. You can simply change timer to something else as long as the dynamic textfield that's named times is changed too.
Damaso
08-20-2003, 03:11 PM
I changed it to MyTimer including the Dynamic text. Error is gone and audio is playing fine, but the timer display is not showing.
Vincent26381
08-20-2003, 03:20 PM
If you are using SWiSH max you can give it the name MyTimer and make sure not to select target.
In Flash then instance name is the one that should be named MyTimer I think...
vBulletin® v3.6.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.