Skip to main content
Inspiring
December 14, 2013
Question

my cursor change if I'm going out of the window

  • December 14, 2013
  • 1 reply
  • 821 views

e

I've created a second cursor named "viseur" that is visible only on a particular scene.

I've called it in my Engine class like that :

        viseur = new Viseur(stage); stage.addChild(viseur); viseur.visible = false;

So it's not visible unless the player goes to the particular scene "room3"

var isMap:Boolean = thisBack == "room3"; if (isMap) { viseur.visible = true;

But, if the player use Alt+Tab during the game in order to go back to the desktop and come back to the game, "visor" is visible ! Even if he's not in room 3 ?

Do you know what could cause this ? (to resume : if the cursor leave the game windows and come back, the new cursor "viseur" is visible even so it is no suppose to be)

Thank you for your help,

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
December 14, 2013

what triggers that if-statement to execute?

Inspiring
December 14, 2013

Sorry, I didn't write proprely the code.

So, I've got this that's been call at the begining of the game :

viseur = new Viseur(stage);

stage.addChild(viseur);

viseur.visible = false;

Then my variable :

var isMap:Boolean = thisBack == "room3";

Then the condition :

if (isMap) {

viseur.visible = true;

The if statement says that when the background is isMap (afk room3),  "viseur" is visible.

In any other background , "viseur" is false.

kglad
Community Expert
Community Expert
December 14, 2013

It's in my createbackground function :

private function createBackground(thisBack:String):void{

trace("Creating new background: "+thisBack);

back = new Background(stage, thisBack);

                              addChild(back);

addChild(player);


you don't understand the issue so someone will probably need to download your file and fix this for you.