나는 AS에 상당히 익숙하며, 내가 찾은 지뢰 찾기 게임을하고있다. 게임 보드의 각 셀에 대해 숫자, 단색 사각형 사각형 무비 클립 (block_mc) 및 폭탄 상자를 표시하는 작은 플래그 (flag_mc)에 대한 동적 텍스트 상자 (number_txt)가 포함 된 무비 클립 (cell_mc)이 있습니다.). 또한 보드에 남은 광산 수 (minecounter_txt)를 세는 별도의 동적 텍스트 상자가 있습니다.this.parent를 다룰 때 Actionscript 3 오류 코드 1119가 발생합니까?
내 문제는 게임을 실행하려고 할 때 언급 된 요소 중 하나와 함께 "this.parent.flag_mc"또는 "this.parent"가있는 곳에서 플래시가 오류 코드를 반환한다는 것입니다. - "1119 : 정적 유형 셀을 사용하여 참조를 통해 가능한 정의되지 않은 속성 flag_mc (또는 다른 요소)에 액세스 할 수 있습니다. " 그리고 minecounter_mc를 사용하면 "1119 : 정적 유형 flash.display : DisplayObjectContainer"로 참조를 통해 가능한 정의되지 않은 속성 flag_mc (또는 다른 요소)에 액세스합니다.
나는 그것이 동적 유형으로 인식 할 수 없습니다. 나는 해결책을 검색하고, 부모, 즉 "무비 클립 (this.parent.flag_mc) 전에 동적 요소를 선언하는 데 도움이 읽을 수 있지만 그것은 도움이되지 않았다.
누군가가 도와 드릴까요? 감사합니다.
을 동영상 클립은 부모의 표시 목록에 추가하지 않은package {
import flash.display.MovieClip;
import flash.display.DisplayObjectContainer;
import flash.events.MouseEvent;
public class cell extends MovieClip {
public var state:Boolean;
public var revealed:Boolean;
public var xcor:uint;
public var ycor:uint;
public var marked:Boolean;
public var cellValue:int;
public function cell(corx:uint, cory:uint) {
// constructor code
this.state = false;
this.revealed = false;
this.marked = false;
this.cellValue = 0;
this.xcor = corx;
this.ycor = cory;
this.flag_mc.visible = false;
this.addEventListener(MouseEvent.CLICK, cellClicked);
}//end of constructor
private function cellClicked(event:MouseEvent):void{
if(event.shiftKey){
if(this.marked){
this.flag_mc.visible = false;
this.marked = false;
this.parent.minecounter_txt.text = String(int(this.parent.parent.minecounter_txt.text) + 1);
} else{
this.flag_mc.visible = true;
this.marked = true;
this.parent.minecounter_txt.text = String(int(this.parent.parent.minecounter_txt.text) - 1);
}
} else{
if(!state){
openCell();
} else{
if(!this.marked){
this.parent.play_btn.visible = true;
}
}
}
}
private function openCell(){
if(!this.marked && !this.revealed){
this.block_mc.visible = false;
this.revealed = true;
this.removeEventListener(MouseEvent.CLICK, cellClicked);
}
}
}//end of class
}//end of package