Skip to main content
1-Visitor
Jan 19, 2021 6:48 AM UTC
Solved

Disable toggle until all steps finished playing

Hi, 

 

I have a toggle to change from one view to another view(e.g View A to View B). I need to disable the toggle from the start of the sequence being played in View A. When all steps in view A has finished playing, then the toggle is visible to be clicked to change to view B. 

 

How can I solve this issue?

sebbenAnswer
14-Alexandrite
Jan 19, 2021 12:51 PM UTC

Hi,

 

you can call a function like this from the Play Stopped event of your model:

 

$scope.showToggle= function(){
 if($scope.view.wdg['model']['steps'] == $scope.view.wdg['model']['currentStep']){
 $scope.view.wdg["toggle-1"].visible = true
 }
 else{
 $scope.view.wdg["toggle-1"].visible = false
 }
}

 

I hope that helps.

4 replies

sebben14-AlexandriteAnswer
14-Alexandrite
Jan 19, 2021 12:51 PM UTC

Hi,

 

you can call a function like this from the Play Stopped event of your model:

 

$scope.showToggle= function(){
 if($scope.view.wdg['model']['steps'] == $scope.view.wdg['model']['currentStep']){
 $scope.view.wdg["toggle-1"].visible = true
 }
 else{
 $scope.view.wdg["toggle-1"].visible = false
 }
}

 

I hope that helps.

Translate
AS161-VisitorAuthor
1-Visitor
Jan 20, 2021 12:32 AM UTC

I have tried the code, but it didn't work. Can I know the steps to call the function correctly. Sorry for any inconvenience. I'm still new to Vuforia Studio. 

Translate
14-Alexandrite
Jan 20, 2021 7:42 AM UTC

Make sure the studio id of the model is "model" and the toggle is "toggle-1" or change it in the code so it matches your id's.  Enter in the JS field of the Play Stopped event showToggle(); Note that the  code will hide the toggle after the first step finished.  If you want to hide it when the first step starts you need to write another function and call it from the Play Started event:

$scope.hideToggle= function(){
 if($scope.view.wdg['model']['steps'] != $scope.view.wdg['model']['currentStep']){
 $scope.view.wdg["toggle-1"].visible = false
 }
}
Translate