more actionscript help (clock)

1084: Syntax error: expecting colon before plus.
1083: Syntax error: rightbrace is unexpected.

(line 71 for both) which is second from bottom

mydate = new Date();
seconds = mydate.getSeconds();
minutes = mydate.getMinutes();
hours = mydate.getHours();
day = mydate.getDay();
date = mydate.getDate();
month = mydate.getMonth();
year = mydate.getFullYear();

if (day==0){
day = “Sunday”
} else if (day==1){
day = “Monday”
} else if (day==2){
day = “Tuesday”
} else if (day==3){
day = “Wednesday”
} else if (day==4){
day = “Thursday”
} else if (day==5){
day = “Friday”
} else if (day==6){
day = “Saturday”
}

if (month==0){
month = “January”
} else if (month==1){
month = “February”
} else if (month==2){
month = “March”
} else if (month==3){
month = “April”
} else if (month==4){
month = “May”
} else if (month==5){
month = “June”
} else if (month==6){
month = “July”
} else if (month==7){
month = “August”
} else if (month==8){
month = “September”
} else if (month==9){
month = “October”
} else if (month==10){
month = “November”
} else if (month==11){
month = “December”
}

if (minutes<10){
minutes = “0”+minutes;
}
if (seconds<10) {
seconds = “0”+seconds;
}

if (hours>12){
hours = hours-12;
ampm = “PM”;
} else if (hours == 12){
ampm = “PM”;
} else {
ampm = “AM”;
}
if (hours == 0){
hours = 12;
}

time = {(hours) + “:” + (minutes) + “:” + (seconds) + " " + (ampm)};

datefinal = {(day) + " " + (month) + " " + (date) + " " + (year)};

oh god, i hate programming lol. i can give you alternate code that works. i lack patience for syntax errors which is why i stopped after JS. :wink:

bump

Looking at it, I cant spot anything wrong with it to be honest.

This is what I would do in the first frame of the actions layer:

time=new Date(); // time object
var seconds = time.getSeconds()
var minutes = time.getMinutes()
var hours = time.getHours()
if (hours<12) {
ampm = “AM”;
}
else{
ampm = “PM”;
}
while(hours >12){
hours = hours - 12;
}
if(hours<10)
{
hours = “0” + hours;
}
if(minutes<10)
{
minutes = “0” + minutes;
}
if(seconds<10)
{
seconds = “0” + seconds;
}
clock_txt.text = hours + “:” + minutes + “:” + seconds +" "+ ampm;

Thats just for the clock though, i’m not sure about the days and months and whatnot.

For this code I just gave you to work, the instance name must be clock_txt though.

i got a whole load of errors with that code. were you using actionscript 3? that is what i use.

this whole thing is pissing me off. i can’t find what the problem is.

Try this:

time = (hours + “:” + minutes + “:” + seconds + " " + ampm);

datefinal = (day + " " + month + " " + date + " " + year);

I use actionscript 2.0, because IMO, actionscript 3 is full of unneccessary stuff that I just don’t use.

that worked for those errors but now it says i am trying to access an undefined property for basically everything i define. so stupid.

i’ve looked everywhere online and all the code in the tutorials basically looks identical to mine but mine just won’t work.

Hey!

I don’t know anything about actionscript, but my husband said you should post your question on http://www.codeproject.com/, and people will help you with it there. He also said you should really post the line numbers with your question.

Natalie

+1 on that.