본문 바로가기

디자인

AS3.0 Compiler Error(컴파일 에러)


//============================================================================================================

// Compiler Error

//============================================================================================================

Description   :  1046: Type was not found or was not a compile-time constant: MouseEvent.

Source         :  public function fN_down(e:Event):void{

원인             :  MouseEvent 이라는 이벤트를 등록하지 않았다. import flash.Events.MouseEvent;

 

1067: Implicit coercion of a value of type Number to an unrelated type String.    output_txt.text = Math.round(count);

 -> 1067: Number 유형의 값을 관련되지 않은 유형 String(으)로 암시적으로 강제 변환하려고 했습니다.

     해결 : output_txt.text = String( Math.round(count) );

 

----------------------------------------------------------------------------------------------------------------

 

1120: Access of undefined property bg_mc.                                                  bg_mc.width = scroll_mc.test_mc.x;

-> 1120: 정의되지 않은 속성 bg_mc에 액세스했습니다.

    해결 : scroll_mc.bg_mc

 

----------------------------------------------------------------------------------------------------------------

 

1021: Duplicate function definition.                                                              function fN_alpha0(p_mc_1:MovieClip){

-> 문제 : 기존에 fN_alpha0 이 존재한다.

    해결 : fN_alpha0 가 2개가 있다는 뜻.. 즉 함수 하나는 이름을 변경해준다

 

----------------------------------------------------------------------------------------------------------------

 

1119: Access of possibly undefined property test through a reference with static type flash.text:TextField.     menu.title_txt.test = xml.main[i].title;

 -> 문제 : test 라는 레퍼런스를 찾을 수 없다.

     해결 : test 가 아니라 text 로 수정..

 

----------------------------------------------------------------------------------------------------------------

 

1151: A conflict exists with definition test in namespace internal.                       var test:Number = 10;

-> 문제 : 이미 위에서 test 를 선언했는데 또 선언하였다 (변수중복선언)

     해결 : 중복으로 선언한 변수를 삭제한다.

 

----------------------------------------------------------------------------------------------------------------

 

1084: Syntax error: expecting rightbrace before rightparen.                               this.addChild(arrSort[i].mc));

-> 문제 : 문법 에러...  또   " ) " 를 썼다...

    해결 : " ) " 를 삭제해서 코드를 제대로 작성한다..

 

----------------------------------------------------------------------------------------------------------------

 

1119: Access of possibly undefined property msg_txt through a reference with static type flash.display:DisplayObjectContainer.

                   parent.parent.msg_txt.text = "hello";

-> 문제 : 디스플레이 오브젝트 컨테이너에는 msg_txt 없다..

 

----------------------------------------------------------------------------------------------------------------

 

//============================================================================================================

// output error

//============================================================================================================

 

stage.addEventListener(MouseEvent.MOUSE_DOWN, fN_down);

function fN_down(e:MouseEvent):void{
     this.removeChild(red_mc);
}

설명 : 한번 리무브차일드 했는데 또 리무브차일드한다..

 

ArgumentError: Error #2025: 제공된 DisplayObject는 호출자의 자식이어야 합니다.
 at flash.display::DisplayObjectContainer/removeChild()
 at Untitled_fla::MainTimeline/fN_down()

 

해결

stage.addEventListener(MouseEvent.MOUSE_DOWN, fN_down);

function fN_down(e:MouseEvent):void{
    if(this.contains(red_mc) == true){
          this.removeChild(red_mc);
    }
}

 

// A.contains( B ) : B 가 A 의 자식이면 true , 아니면 false

 

----------------------------------------------------------------------------------------------------------------

 

 

 

 

 

 

================================================================================================================

 

 

    Class 관련 에러

 

 

================================================================================================================

 

Description   :  1046: Type was not found or was not a compile-time constant: MouseEvent.

Source         :  public function fN_down(e:Event):void{

원인             :  MouseEvent 이라는 이벤트를 등록하지 않았다.

해결             :  import flash.Events.MouseEvent;

 

 

Description   :  1046: Type was not found or was not a compile-time constant: SimpleButton.

Source         :  ...

원인             :  SimpeButton 이라는 이벤트를 등록하지 않았다.

해결             :  import flash.display.SimpleButton