Domanda

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?

È stato utile?

Soluzione

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)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top