Ask a Question related to Macromedia Flash Actionscript, Design and Development.
-
trints #1
How can I avoid NaN
When my .swf loads the variables from the .txt file
(days=2&hours=17&minutes=10&seconds=56), the swf file starts and shows seconds
"56" for one second then says "NaN"...Any help is appreciated.
Thanks,
Trint
trints Guest
-
Avoid coping homepage ??
Hi al, What should i do so people cant copy or save my homepage? Regards Sasha -
How to avoid this
Hi, I have a project where when the user scroll over the buttons a picture or movie display on the screen. All works fine, but moving between... -
Avoid SmartNavigation
I've done some investigating about various problems with the SmartNavigation feature. It seems to me that the general consensus is to avoid... -
Avoid Insert
I have an insert page and have written some javascript to validate the page. The validation works great but I need to stop the insert if the user... -
how to avoid authentication
Hi All users should authenticate to reach some page. How to avoid this for some users. Thanks Konrad -
kglad #2
Re: How can I avoid NaN
variables loaded from a text file are loaded as string variables. you'll need to convert them to numbers.
kglad Guest
-
trints #3
Re: How can I avoid NaN
kglad,
I've been reading and can't get it right with number ()
How would I do that here:
stop();
var dateVars = new LoadVars();
dateVars.onLoad = function(ok) {
if (ok) {
clock.secondsleft = dateVars.seconds;
clock.minutesleft = dateVars.minutes;
clock.hoursleft = datevars.hours;
clock.daysleft = dateVars.days;
}
};
dateVars.load("countdown.txt");
myinterval = setInterval(countDown, 1000);
function countDown() {
clock.secondsleft -= 1;
if (clock.secondsleft<0) {
clock.secondsleft += 60;
clock.minutesleft -= 1;
}
if (clock.minutesleft<0) {
clock.minutesleft += 60;
clock.hoursleft -= 1;
}
if (clock.hoursleft<0) {
clock.hoursleft += 24;
clock.daysleft -= 1;
}
}
Thanks,
Trint
trints Guest
-
-
Laiverd.COM #5
Re: How can I avoid NaN
Don't see you using Number anywhere in your code, so let me just add to the
shots in the dark ;-)
clock.secondsleft = Number(dateVars.seconds);
clock.minutesleft = Number(dateVars.minutes);
clock.hoursleft = Number(datevars.hours);
clock.daysleft = Number(dateVars.days);
John
--
----------------------------------------------------------------------------
-----------
RESOURCES
[url]http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash[/url]
----------------------------------------------------------------------------
-----------
TUTORIALS at
[url]www.laiverd.com[/url]
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------
Laiverd.COM Guest
-
kglad #6
Re: How can I avoid NaN
i don't think there are any situations when parseInt() would work and number() or multiplying by 1 would fail. in addition, parseInt() is very different from number().
kglad Guest



Reply With Quote

