Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
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?
Solved! Go to Solution.
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.
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.
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.
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
}
}
Great. Thank you so much for your help.