There are two issues at play here:
- The call
Engine.viseur.stage.removeChild(viseur);
does not work because the variableviseur
is private to the Engine class. If you wish for it to be accessible to other classes, you need to make itpublic
. - However, the other issue with this is that the
viseur
variable is not a static variable either. So accessing it like this,Engine.viseur.stage.removeChild(viseur);
is still incorrect even if you fix the variable to bepublic
. if you wish to access it via another class, you can either 1) pass a reference of the instance of theEngine
class to your other class so that it can access theviseur
variable or 2) make theviseur
variable a static variable, but remember if you do this, that means you can only ever have oneViseur
object namedviseur
.