Error 1046: Type was not found or was not a compile-time constant: Component Event

Hi Everyone…

I am getting an Error 1046: Type was not found or was not a compile-time constant: Component Event.The ComponentEvent class has been imported,and also the event handling code is there. I am not sure what else is wrong, hope somebody can advise me. Thanks. The code is below, the point where the error occurs as indicated by the compiler has been highlighted.


package  
{
 
import flash.display.Sprite;
import flash.media.Camera;
import flash.media.Microphone;
import flash.media.Video;
import fl.controls.TextArea;
import fl.controls.Button;
import fl.controls.TextInput;
import flash.events.SyncEvent;
import flash.events.MouseEvent; 
import flash.events.FocusEvent;
import flash.net.SharedObject;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.events.NetStatusEvent;
import flash.events.FocusEvent;
import flash.events.ComponentEvent;
 
 
public class VideoChat extends Sprite
{
  private var button:Button;
  private var text_so:SharedObject;  
  private var textArea:TextArea;
  private var textInput:TextInput;
  private var chatName:TextInput;  
  private var nc:NetConnection;
  private var nsOut:NetStream;
  private var nsIn:NetStream;
  private var rtmpNow:String;
  private var msg:Boolean;  
  private var cam:Camera;
  private var mic:Microphone;
  private var vid:Video; 
 
 
  public function VideoChat () 
 
  {
   //Set up UI
   textArea = new TextArea();
   textArea.setSize(500,280);
   textArea.move(20,54);
   addChild(textArea);
 
   textInput = new TextInput();
   textInput.setSize(500,24);
   textInput.move(20,340);
   textInput.addEventListener(ComponentEvent.ENTER,checkKey);
   addChild(textInput);
 
   button = new Button();
   button.width=50;
   button.label="Send";
   button.move(20,370);
   button.addEventListener(MouseEvent.CLICK, sendMsg);
   addChild(button);
 
   chatName = new TextInput;
   chatName.setSize (100,24);
   chatName.move (80,370);
   chatName.text="<Enter Name>";
   chatName.addEventListener (FocusEvent.FOCUS_IN, cleanName);
   addChild(chatName);  
 
   //Connect
   rtmpNow="rtmp:/VideoChat ";   
   nc=new NetConnection;
   nc.connect (rtmpNow);
   nc.addEventListener(NetStatusEvent.NET_STATUS,doSO); 
 
 
   cam = Camera.getCamera();
   mic=Microphone.getMicrophone();
 
   //Camera Settings
   cam.setKeyFrameInterval(15);
   cam.setMode (240, 180, 15, false);
   cam.setMotionLevel(35,3000);
   cam.setQuality(40000 / 8,0);
 
   //Microphone Settings
   mic.gain = 85;
   mic.rate=11;
   mic.setSilenceLevel (25,1000);
   mic.setUseEchoSuppression (true);
 
   //Video Setup
   vid=new Video(cam.width, cam.height);
   addChild (vid);
   vid.x=10, vid.y=20;   
 
   //Attach local video and camera
   vid.attachCamera(cam);   
 
 
 
  }
 
  private function doSO(e:NetStatusEvent):void
  {
   good=e.info.code == "NetConnection.Connect.Success";
   if(good)
   {
    //Set up shared object
    text_so=SharedObject.getRemote("test", nc.uri, false);
    text_so.connect (nc);
    text_so.addEventListener(SyncEvent.SYNC, checkSO);
   }
 
  }
 
  private function checkSO(e:SyncEvent):void
  {
   for (var chung:uint; change<e.changeList.length; chng++)
   {
    switch(e.chageList[chng].code)
    {
     case "clear":
      break;
 
     case "success":
      break;
 
     case "change":
      textArea.appendText (text_so.data.msg + "
");
      break;
 
    }
   }
  }
 
 
  private function cleanName(e:FocusEvent): void
  {
   chatName.text="";
  }
 
  private function sendMsg(e:MouseEvent):void
  {
   noName=(chatName.text=="<Enter Name>" || chatName.text=="");
   if (noName)
   {
     textArea.appendText("You must enter your name 
");
   }
 
   else
   {
    text_so.setProperty("msg", chatName.text +": " + textInput.text);
    textArea.appendText (chatName.text +": "+textInput.text +"
");
    textInput.text="";
   }
 
 
  }
 
  **private function checkKey (e:ComponentEvent):void**
  {
   noName=(chatName.text=="<Enter Name>" || chatName.text=="");
   if (noName)
   {
     textArea.appendText("You must enter your name 
");
   }
 
   else
   {
    text_so.setProperty("msg", chatName.text +": " + textInput.text);
    textArea.appendText (chatName.text +": "+textInput.text +"
");
    textInput.text="";
   }
  }
 
  //Create NetStream instances
  private function checkConnect  (e:NetStatusEvent):void
  {
   msg=e.info.code == "NetConnection.Connect.Success";
   if(msg)
   {
    nsOut=new NetStream(nc);
    nsIn=new NetStream(nc);
 
    //NetStream
    nsOut.attachAudio(mic);
    nsOut.attachCamera(cam);
    nsOut.publish("camstream");
    nsIn.play("camstream");
 
   }
 
  }
 
}
 
}