Jump to content
(Open Beta) HyperSpin 2 is now available for everyone ×

Help with "Clock" for PSP Theme


Recommended Posts

Posted

I've been working on this PSP theme to make it look like the PSP XMB, and I pretty much have it the way I want it, except for one thing.

 

I can't figure out how to make the clock.

 

I know it should be a flash clock and I've tried for a couple of days following tutorials with no luck (I'm not much of a coder).

 

Here's the theme with a clock mockup done in photoshop, if anyone can point me in the right direction or code a quick clock that would be great. I plan on uploading it to the "Downloads" section to share when I'm done if anyone wants to use it. Anything would help, I'm lost lol.

 

Template_zps2raovkjz.png

 

Oh and the game info text is the same color as the PSP icons now :)

Posted

This is the code for clock and date
 

var now:Date = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var ampm ;

if (hours >= 12) {
    ampm = "PM";
} else {
    ampm = "AM";
}

if (hours > 12){    
    hours = hours - 12;
}
if (hours == 00){    
    hours = 12;
}

if (hours < 10){    
    hours = "0" + hours;
} else {
    hours = hours;
}

if (minutes < 10){    
    minutes = "0" + minutes;
} else {
    minutes = minutes;
}

total_txt.text = hours + ":" + minutes + " " + ampm ;

var day = now.getDate();
var tday = now.getDay();
var year = now.getFullYear();
var month = now.getMonth();
var mArray:Array = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
var dArray:Array = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];

datetotal_txt.text = dArray[tday] + " | " + mArray[month] + " - " + day + " - " + year ;

It is using 2 dynamic text datetotal_txt (date) and total_txt (clock). Set the swf to loop or the clock won't update. Probably it is better to just edit the template posted in the tutorial thread.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...