Boolean not working as expected

This code doesn’t seem to be making my animation jump to a scene (to reset it), but I’m not sure why, any suggestions?:

	if (Button E && ButtonA	 == true ){

hypeDocument.showSceneNamed(main, hypeDocument.kSceneTransitionCrossfade, 1.0);
console.log(‘a and e are true’);

        }

else {

console.log(‘a and e are not true’);
}
Diagram 0.21.hype.zip (222.4 KB)

No space in between Button and E.

Button E // wrong
ButtonE // correct

You also have a period (.) somwhere in your code that’s throwing an error.
In a parameter list.

WOW, you have a lot of errors firing.

main hasn’t been declared as a variable. Did you mean to put ‘main’ as in the name of the scene?

thanks I have tried removing the space but its the same, yes - i meant ‘main’ to be the name of the scene.

Interesting… I recon thats why it wont play properly in safari, I’m coming to the end of the project now and will probably need help debugging/optimising. PM me if you have time to work on this (paid job - beer money).

After you remove the space make sure you declare the variable in your on scene load function :wink: It’s not there. The others are.

In your Function element3start() you have

var.symbolInstance = hypeDocument.getSymbolInstanceById('333');

remove the period (.) after the var and make it a space

thanks for all your help, for some reason the console was showing this error message:

Error in button_combo_ifelse_statement: ReferenceError: main is not defined

even though I had called the scene ‘main’ (by right clicking and selecting rename in the scene window)

I got past this by returning the current scene name:

var currentScene = hypeDocument.currentSceneName();

As I said before, you have to include the scene name in quotes.

Not main (because the browser thinks this is a variable

‘main’ or “main” is the correct way.

EDIT - Check out the post by Mark here that will help you when deciphering errors. Tip always check your console when your project doesn’t run as expected.