1 package
2 {
3 import flash.display.MovieClip;
4 import flash.events.Event;
5 flash.events.MouseEvent;
6 flash.filters.GlowFilter;
7 flash.text.TextField;
8 flash.text.TextFormat;
9
10 public class Main extends MovieClip
11 {
12 var contents:String;
13 whiteSpace:String;
14 tftxt:String;
15 var isPause:Boolean =false16
17
18 var tf:TextField = new TextField();
19 var f:TextFormat= TextFormat();
20 function Main()
21 {
22 stage.frameRate =1023
24 tf.autoSize ="left"25
26 f.size =4027 f.color =0xFFFFFF28 f.font="楷体"29 tf.defaultTextFormat =f;
30 tf.width =stage.stageWidth;
31 tf.y =18032 addChild(tf);
33
34
35
36 initApp();
37 stage.addEventListener(MouseEvent.CLICK,restart);
38 }
39 private function initApp():void
40 41 tf.addEventListener(Event.ENTER_FRAME,scrollText);
42 whiteSpace=""43 contents ="秦时明月汉时关,万里长征人未还。"+
44 "但使龙城飞将在,不教胡马渡阴山。"45
46 for(var i:uint =0;i<550/40+1;i++)
47 {
48
49
50 whiteSpace+=" "51
52 }
53 tftxt =whiteSpace+contents;
54 tf.text=tftxt;
55 56 function restart(e:MouseEvent):57 58 if(e.target==e.currentTarget)
59 60 if(tf.text==)
61 initApp();
62 else isPause = !isPause;
63 64 65
66 private function scrollText(e:Event):67 68 if(!isPause)
69 70 tftxt=tftxt.substring(1);
71 tf.text =72 73 {
74 tf.removeEventListener(Event.ENTER_FRAME,1)">75
76 }
77 tf.filters = [new GlowFilter(0x0055FF,1,6,6)];
78 79 80 }
81 }