The first step is to create a new file with black background and other defaults. In the scene with a text tool to pull out a text box, set to dynamic text, variable text, multi-line edit; The color set is white, is to increase the contrast, the font size is 16, formatted in the first line indent (16x2), line spacing is 3. Add the following code to the first frame: Here is the text content to display, and the quotation marks must be written in the English state. /n defines a newline, which is the beginning of a new paragraph. Text1= "Friends, everyone good." Welcome to the Flash zone. \ n With the advent of the Internet era, flash through the network of the Dongfeng Rapid development. This section will be with you into the world of the flash. If you are not a flash fan, then look at the famous flash of the small works, his work number 3rd, but won the International Competition finalist Award. Chiang Kai-shek is known as the first person in China, but in my mind is small. Chiang's art is very good, he is a graduate of the Academy of Fine Arts, and a small addition to art and unique creativity, programming ability can not be ignored, I sent him in the forum of the game. Of course, many big Flash have their own style, they strive to create the brilliance of China's flash. How, see this, your heartbeat? You may ask, can I do animation? I can't program, what do I do? Clearly tell you, a big flash once said, Flash basic Dongdong you can master in one weeks. Like do flash MV Works, no programming is also possible, as long as your creative or art good. If your art and design is good, then don't bury your talent, let Flash help you realize your dream! What are you waiting for, join! Maybe the next famous flash-Guest is you! "; ll = text1.length;//to get the length of the text i = 1;//initialization variable
Step two: In frame 6th, press F5 to add still frames, then open the library to identify the typed sound file by right-clicking on the sound file, selecting linkage, writing sound in the identifier box, adding a new layer, pressing the F6 key in frame fourth and adding the following code to the frame: Ss=new sound ()//Create a new sound object Ss.attachsound ("sound");//sound to the same identifier as the sound file in the library if (i<ll+1) { Text = text1.substring (0,i);//Remove substring from Text1, display in text dynamic text box, I value range is 1~ll SV = Text1.charcodeat (i-1),//returns the 16-bit code value of the i-1 character in the "Text1" string, ranging from 0~ll-1 i++; if (number (SV) ==9) {//If a newline character is encountered \ n, stop typing sound Ss.stop (); } else { Ss.start ()//otherwise play the typing sound } } else { Stop ()//After text is finished } In frame sixth, add code: gotoAndPlay (4);//repeatedly executes the statement until it stops
The third step: the usual summary: Through this example you can grasp the text settings, the method of binding sound, string manipulation techniques. The index number of the string is starting from 0, such as a string "1,2,3,4,5", the length is the final index number plus 1, i.e. 4+1 equals 5. Index number 0 corresponds to 1; Index number 1 corresponds to 2; Index number 2 corresponds to 3; and so on. If you figure out the concept, you can understand the statement above. Here I also sincerely hope that more friends to learn flash, even if you do not art, research as is a good way. Willing to work with you as soon as possible acquaintance, together into the paradise of the Flash.
Download Source Files |