나는 mc라는 컨테이너를 가지고 있는데, 그 안에는 옵션의 벽을 만들기 위해 영화 클립 격자가 생성됩니다. .. 제공된으로 DisplayObject는 호출자의 자식이어야합니다제공된 DisplayObject는 호출자의 자식이어야합니다.
코드는 다음과 같습니다 : 오류 # 2025 :이 옵션 중 하나를 선택하면이 메시지가 나타납니다
In the Class iniciarApp I've this: var mc:MovieClip = new MovieClip(); var grilla:Grilla = new Grilla(); mc.x = 0; mc.y = 0; mc.name = "square"; addChild(mc); grilla.name = "grilla"; grilla.x = mc.x; grilla.y = mc.y; mc.addChild(grilla); ---------- in Grilla.as: public class Grilla extends MovieClip { private var boxNum:int = 48; private var cols:int = 6; private var rows:int = Math.ceil(boxNum/cols); private var boxCount:int = 0; public function Grilla(){ for (var py:int = 0; py < rows; py++) { for (var px:int = 0; px < cols; px++) { var caja:clip = new clip(); caja.x = -115 + caja.width * px; caja.y = -150 + caja.height * py; caja.name = "opcion" + (py + 1); caja.mouseChildren = false; var contentText = new TextField(); var formato = new TextFormat(); formato.size = 14; contentText.defaultTextFormat = formato; contentText.width = 36; contentText.height = 34; contentText.x = -10; contentText.y = -10; for (var u:uint = 0; u < boxNum; u++) { contentText.text = "" + u; } addChild(caja); caja.addChild(contentText); if (boxCount < boxNum) { caja.buttonMode = true; caja.addEventListener(MouseEvent.CLICK, seleccionarOpcion); } boxCount++; } } var barra:score = new score(); barra.x = 80; barra.y = -200; barra.puntajeTXT.text = "hola"; addChild(barra); } private function seleccionarOpcion(m:MouseEvent):void { TweenMax.to(MovieClip(m.target), 0.5, {scaleY: -1}); m.target.removeEventListener(MouseEvent.CLICK, seleccionarOpcion); m.target.buttonMode = false; var opcionABuscar:String; opcionABuscar = m.currentTarget.name; var opt:String = opcionABuscar.substring(6); **[HERE] i need to remove the instance of grilla created in the other class** **m.currentTarget.parent.parent.removeChild(grilla);** << this is not working var trivia:generarTrivia = new generarTrivia(opt); trivia.x = 0; trivia.y = 0; trivia.name = "trivia"; addChild(trivia); } }
첫 번째 코드로 시도해도 아무런 변화가 없습니다. Line 75 \t 1120 : 정의되지 않은 속성 grilla 액세스. – m4g4bu
더 많은 정보를 제공해야합니다. 객체 그릴을 포함하는 나머지 코드 게시 – shackleton
코드 – m4g4bu