Removechild unknown identifier

removechild is not working
ran a debug on poweshell it comes out an error
Source/Player.hx:26: characters 2-13 : Unknown identifier : removeChild
any help would be great, thank you.

import openfl.display.MovieClip;
import openfl.Lib;

  • @author Russel Tusay
    class Player
    public var clip1:MovieClip;
    public function new()

    public function anim(){
    public function func1(){
    if(clip1 != null){
    clip1.x += 1;
    clip1.y = 100;
    public function remove(){


Maybe you forgot to extend Sprite or extend MovieClip ?

Ok, if that is not the case, the thing is: from where do you want to remove the child? If Player doesn’t extend a Container (like Sprite or MovieClip) you can not remove it from there. You could remove the clip1 from his parent, whoever the parent may be, by doing:
This can crash on you if clip1.parent is null, so the safe way is

if (clip1.parent != null) clip1.parent.removeChild(clip1);