The production of time-timed playing sound of flash automatic display

Source: Internet
Author: User
Tags define definition expression getdate integer logical operators
Timing | display

Automatic display of time-timed playback sound--date dates () Basic application of Sound sound ()

Effect Demo:

Click here to download the source file

New Date ()
New Sound ()

Are the two basic classes that beginners often use. One is about date and time acquired, one is about sound control, and beginners start from these two basic classes and go deeper and further down the steps. The basic classes and statements used in this example have

Sound () Section

Sande = new Sound ()///Definition Sande is Sound () sound class
Sande.loadsound ("url", true), or the. mp3 file that loads the URL to enter the Sande.
Sande.stop ()///Ding music playback in Sande
Sande.start ()//Start music playback in Sande

Date () section

Today_date = new Date ()//is defined today_date as the date () class
Today_date.gethours ()//Gets the current number of hours 0-23.
Today_date.getminutes ()//Gets the current number of minutes 0-59.
Today_date.getseconds ()//Gets the current number of seconds 0-59.
Today_date.getfullyear ()//Get the current number of years, four digits: if current is 2005
(Today_date.getmonth () +1)//Get the current number of months, 0-11 (so be careful to add a 1 in use)
Today_date.getdate ()//Gets the current date number, and automatically gets an integer of 1-28, 1-29, 1-30, 1-31, by year and month.
Today_date.getday () Gets the current number of weeks, returning an integer with a value of 0-6, of which 0 is Sunday, 1-6 is Monday to Saturday.

Color () Color class

My_color = new color (zoutxt);//Definition My_color is a color () class container for instance zoutxt (here refers to the zoutxt text box)
My_color.setrgb (0xFFFFFF)//Set instance zoutxt text box color is (0xFFFFFF) RGB 16 color code, the first two bits 0x is the offset value, the last six digits 22 for a group of R, G, b values.

if (condition comparison) {
Statement executed when the condition is true
} else {
Statements executed when the condition is false
}
}
switch (expression) {
Case X1:
Expression value equals the statement executed when X1
Break
Case X2:
Expression value equals the statement executed when X2
Break
.......
.....
Default:
Expression value is not x1, x2 、...... The statement executed within the scope.
Break
}

gotoAndPlay (2);//turning statement.

Here is the custom function

Define the FF function as a custom function, with the two-shape parameter xx, YY (can be numeric but also character channeling, as needed to define the future use of the same generation of parameters)

function ff (xx, yy) {
Dqtime= ....//Place the statement to be executed within the function
return (dqtime);//Returns the value of Dqtime
}

When called, use the following format

:d dd=ff (16,17);

The comparisons used with the logical operators are

&& and
|| Or
= = equals
< less than
> Greater than

As the actual script is as follows:
The contents of the first key frame

Sande = new Sound ();
Sande.loadsound ("Http://www.ecljs.com/local/ccxx/oa/dzyj/fj/2004-5/23-2004523938151.mp3", true);
Sande.stop ();

The contents of the second key frame

Bldt = "garrulous comment on the world welcome you poor assessment!" ";
DLDT1 = Bldt;
Today_date = new Date ();
My_color = new color (zoutxt);
function ff (xx, yy) {
if (xx<10 && yy<10) {
Dqtime = (today_date.gethours () + ":" + "0" +today_date.getminutes () + ":" + "0" +today_date.getseconds ());
else if (xx<10) {
Dqtime = (today_date.gethours () + ":" + "0" +today_date.getminutes () + ":" +today_date.getseconds ());
else if (yy<10) {
Dqtime = (today_date.gethours () + ":" +today_date.getminutes () + ":" + "0" +today_date.getseconds ());
} else {
Dqtime = (today_date.gethours () + ":" +today_date.getminutes () + ":" +today_date.getseconds ());
}
return (Dqtime);
}
Switch (Today_date.getday ()) {
Case 1:
Zou = "Monday";
My_color.setrgb (0xFFFFFF);
Break
Case 2:
Zou = "Tuesday";
My_color.setrgb (0xFFFFFF);
Break
Case 3:
Zou = "Wednesday";
My_color.setrgb (0xFFFFFF);
Break
Case 4:
Zou = "Thursday";
My_color.setrgb (0xFFFFFF);
Break
Case 5:
Zou = "Friday";
My_color.setrgb (0xFFFFFF);
Break
Case 6:
Zou = "Saturday";
My_color.setrgb (0X33FF00);
Break
Case 0:
Zou = "Sunday";
My_color.setrgb (0xff0000);
Break
Default:
Zou = "";
Break
}
Dqdate = (today_date.getfullyear () + "year" + (Today_date.getmonth () +1) + "month" +today_date.getdate () + "Day");
Dqtime = FF (Today_date.getminutes (), today_date.getseconds ());
PDJ = (Today_date.getmonth () +1) + "/" +today_date.getdate ();
Switch (PDJ) {
Case "12/31":
HC = "Tomorrow is the New Year";
Break
Case "1/1":
HC = "New Year's Day";
Bldt = "Wish all netizens Happy New Year";
Break
Case "12/25":
HC = "Christmas Eve";
Break
Case "12/26":
HC = "Merry Christmas";
Bldt = "I wish all netizens happy every day";
Break
Case "1/22":
HC = "Today is a lunar day";
Break
Case "1/28":
HC = "No Sleep Tonight";
Bldt = "I wish all the Friends of the dog auspicious";
Break
Case "1/29":
HC = "Spring Festival";
Bldt = "The administrator to the Netizen!" Good New Year! ";
Break
Case "2/12":
HC = "Lantern Festival";
Break
Case "3/1":
HC = "shaving faucet";
Break
Case "3/8":
HC = "Women's Day";
Break
Case "4/5":
HC = "Qingming Festival";
Break
Case "4/16":
HC = "Easter";
Break
Case "4/30":
HC = "Tomorrow Labor Day";
Break
Case "5/1":
HC = "Labor Day";
Break
Case "5/31":
HC = "dragon Boat Festival";
Break
Case "6/1":
HC = "Children's Day";
Break
Case "9/30":
HC = "Tomorrow's National Day";
Break
Case "10/1":
HC = "National Day";
Break
Case "10/6":
HC = "Mid-Autumn Festival";
Break
Default:
HC = "";
Bldt = DLDT1;
Break
}
if (today_date.getfullyear () = = "2007") {
HC = "Should change the picture";
}
//
if (today_date.gethours () <23 && today_date.gethours () >6) {
if (today_date.getminutes () + ":" +today_date.getseconds () = = "30:0" | | Today_date.getminutes () + ":" +today_date.getseconds () = = "0:0") {
Sande.start ();
}
}

Add * * * in the third key frame

gotoAndPlay (2);



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.