Scene Unload, variable unload


Hello everyone, i´m having a hard time understanding how to resolve a problem with my code. I think the problem is when the scene unloads, i have to do something when my code and i was hopping someone could help me. When the scene loads the first time, everything works great, i have a button event and when the user clicks on it the pictures fadeToggle. But if the user navigates to another scene and then returns, the pictures appear and fade quickly, and that´s not the behavior i´m expecting, below is my code:

function clickGaleria(hypeDocument, element, event
              var i = 0;   
               var stuff =["websiteCoolpark","appCoolpark","appStructures","websiteHotelLeiria","appEco"];
                       i = (i+1)%stuff.length;  

Pls help, i´m stuck!!!.

(Mark Hunte) #2

Hi, can you post the project

(Mark Hunte) #3

It seems to work here…? (56.5 KB)

(Mark Hunte) #4

I suspect that your problem is you have this code running on your first scene unload but then on another onload or unload. Which in my test give the behaviour you are describing


Hi, i just need help with this part of the project, the rest is irrelevant, do you know whats wrong with my code?

João santo


I’m using this code on the 4 scene of my project. In this scene i have a button and the code is inside: “onsceneload”, i chose run JavaScript function and i put the this code inside.

João santo

(Mark Hunte) #7


It works in mine thats why it would help if you posted because you might have some thing set up that is different to mine.