Note that there are some explanatory texts on larger screens.

plurals
  1. POThe supplied DisplayObject must be a child of the caller
    primarykey
    data
    text
    <p>I've a container called mc, inside of him I generate a grid of movieclips in order to make a wall of options. When I select one of this option, this message appears: </p> <blockquote> <p>Error #2025: The supplied DisplayObject must be a child of the caller..</p> </blockquote> <p>The code is:</p> <pre> 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 &lt; rows; py++) { for (var px:int = 0; px &lt; 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 &lt; boxNum; u++) { contentText.text = "" + u; } addChild(caja); caja.addChild(contentText); if (boxCount &lt; 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);** &lt;&lt; this is not working var trivia:generarTrivia = new generarTrivia(opt); trivia.x = 0; trivia.y = 0; trivia.name = "trivia"; addChild(trivia); } } </pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload