Friday, September 15, 2006

Some Codes For Flash

Hello,
as u can read from my profile i lyk flash, so today i will share wid u one actionscript code of flash

Title : Making Flash To Show Time & Date

Procedure: (U can set the Stage according to ur lykin too!)Set the stage to 420 px X 24 px then Start of by makin a dynamic text box wich fits the size of the stage 420 x 24 and the font size abt 40 (u can set the width and height at the same place where the textbox's co-ordinates x and y r shown). Give it the variable name "textdate" (Widout quotes). Click on the dynamic text box once and press F8 to convert it into a movieclip. Create another a Layer (Layer 2) and name it "actions" (widout quotes). On Layer 1 (the one wid the dynamic text box on it), make a frame(F5) on frame 2 of the timeline and make 2 keyframes (F6) on Frame 1 and Frame 2 of the actions layer (Layer 2)
On Frame 1 of the actions layer, press F9 to pop up the actions panel and type in (copy paste) this extremely long code

function howlong(arg) {
if (length(arg)==1) {
arg = "0" + arg;
return arg;
}
else {
arg = arg;
return arg;
}
}
myDate = new Date();
hr = howlong(String(myDate.getHours()));
mnt = howlong(String(myDate.getMinutes()));
sec=howlong(String(myDate.getSeconds()));
daytext = myDate.getDay();
dd = myDate.getDate();
mm = myDate.getMonth();
yyyy = myDate.getFullYear();
switch (daytext) {
case 0: daytext = "Sunday";
break;
case 1: daytext = "Monday";
break;
case 2: daytext = "Tuesday";
break;
case 3: daytext = "Wednesday";
break;
case 4: daytext = "Thursday";
break;
case 5: daytext = "Friday";
break;
case 6: daytext = "Saturday";
break;
}
switch (mm) {
case 0: mm = "January";
break;
case 1: mm = "Febuary";
break;
case 2: mm = "March";
break;
case 3: mm = "April";
break;
case 4: mm = "May";
break;
case 5: mm = "June";
break;
case 6: mm = "July";
break;
case 7: mm = "August";
break;
case 8: mm = "September";
break;
case 9: mm = "October";
break;
case 10: mm = "November";
break;
case 11: mm = "December";
break;
}
textdate = (hr + ":" + mnt + ":" +sec + " - " + daytext + "," + dd + " " + mm + " " + yyyy)

On Frame 2 of the actions layer, press F9 nd put in the following script.

gotoAndPlay(1);

Thts It! U r done....press CTRL + Enter to check the results!

TIP: I would lyk to share u wid one of font tht i used for the time and date tht is the "Digital Readout", lyk those numbers we see on out wrist watch, u can download the font here " http://www.savefile.com/files/72602 "

NOTE: 1. Tell me wen the file is Expired i will update it again
2. I m not the creator of this script..i m jmus sharing...Full Credits To The Creator

1 comment:

Anonymous said...

thanks a lot for teachin us flash ( eventhough this is juzz one of the thousands websites regardin this!!LOL)jkin man i hope u continue to post regularly cuz m tryin to study flas and will follow ur tips every now n then n try to post some jokes as well in order to make us laugh n learn two - in - one neways i wil comment regularly if u dont post regularly bye
Mehal