Flash is automatically refreshed every few seconds

Source: Internet
Author: User

Stop ();
// Declare the variable
Var my_sound: Sound = new Sound ();
My_sound.attachSound ("dazi.mp3 ")
My_sound.start ()
Var id: Number = setInterval (dazi, 100 );
Var I: Number = 0;
Var my_fmt: TextFormat = new TextFormat ();
Var my_str: String = "Goodbye to Kangqiao -- Xu Zhimo" + newline + "I walked gently," + newline + "as I gently came; "+ newline +" I waved gently. "+ newline +" let's see the clouds of the West. ";
// Create dynamic text
This. createTextField ("my_txt", 1,100, 40,120, 20 );
// Control the automatic size adjustment and left alignment of text fields
My_txt.autoSize = true;
// Set text line spacing
My_fmt.leading = 6;
// Set the text color
My_fmt.color = 0x000000;
// Apply the new text format to dynamic text
My_txt.setNewTextFormat (my_fmt );
// User-defined functions
Function dazi (){
// If the variable I is not greater than the number of my_str characters
If (I <= length (my_str )){
I ++;
// Display the characters of my_str in dynamic text (starting from the first character with the length of I)
My_txt.text = my_str.substr (0, i-1 );
// Variable increments by 1
}
// If the variable I is greater than the number of my_str characters
If (I> length (my_str )){
My_sound.stop ()
// Stop setInterval () call
ClearInterval (id );
SetTimeout (function (){
I = 0;
My_txt.text = "";
My_sound.start ()
Id = setInterval (dazi, 100 );
},5000 );
}
}

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.