无法插入flash.![](https://www.cnblogs.com/Emoticons/qface/055243873.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
Save as EventDemo.as
1 package
2 {
3 import flash.events.MouseEvent;
4 import flash.display.Sprite;
5
6 public class EventDemo extends Sprite
7 {
8 private var eventSprite:Sprite;
9 public function EventDemo ()
10 {
11 Init ();
12 }
13 private function Init ():void
14 {
15 eventSprite=new Sprite ();
16 addChild(eventSprite);
17
18 eventSprite.graphics.beginFill(0xff0000);
19 eventSprite.graphics.drawCircle(0,0,50);
20 eventSprite.graphics.endFill();
21
22 eventSprite.x=stage.stageWidth/2;
23 eventSprite.y=stage.stageHeight/2;
24
25 eventSprite.addEventListener(MouseEvent.MOUSE_DOWN,MouseDown);
26 eventSprite.addEventListener(MouseEvent.MOUSE_UP,MouseUp);
27 }
28 private function MouseDown(e:MouseEvent):void
29 {
30 trace( "Mouse Down!" );
31 }
32 private function MouseUp(e:MouseEvent):void
33 {
34 trace( "Mouse Up!" );
35 }
36 }
37 }