Question

I've got two classes. One is main class, the other puzzle.

How to remove a child in the main class, if a function is true in the puzzle class? I tried :

Main.as

if(puzzle.backToJardin = true){
stage.removeChild(target);
}

Puzzle.as

public function backToJardin(thisBack:String):void{
Engine.newBack = "jardin";
stageRef.dispatchEvent(new Event("changeBackground"));
}

How can i achieve this?

Was it helpful?

Solution

to sum up for others with the same problem.

to check if object contains method or property try:

if ("methodOrPropertyName" in object)

and to chect if this is function try:

if( object.methodOrPropertyName is Function)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top