Hi
I have a general question about how to detect when focus is given to a scene.
I’m using the MultiSceneMultiLevel example as a starting point for my game. I’m not using the loader, since I only have one ‘level’ or game format at present. The game has a timer, and some other setups, so I thought since a user is likely to repeatedly enter this scene, I should trap some event to setup these things. I wonder if there is such a thing as onGetFocus. There seems to be OnFocus or OnActiveFocus, but these seem not to work (I think this is mentioned in the squaby source for dynamically loaded scenes). My scene I think is not dynamically loaded, since all scenes are created upon startup (and set to opacity 0). I thought of the following idea:
SceneBase {
id: gameScene
// the name of the current level gets stored here
property string activeLevelString
// the current level gets stored here
property variant activeLevel
onOpacityChanged: {
if (opacity === 1) {
console.log("onOpacityChanged!!")
}
}
i.e. use onOpacityChanged to get an event, but I found strangely the above situation will fire two events (i.e. I see 2 of the above console messages). I’m not an expert but in Corona, there are events like onCreateScene, onEnterScene, onExitScene. These seem handy. What is the V-play equivalent?
Cheers, Michael.