cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Disable toggle until all steps finished playing

AS16
13-Aquamarine

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?

ACCEPTED SOLUTION

Accepted Solutions
sebben
14-Alexandrite
(To:AS16)

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.

View solution in original post

4 REPLIES 4
sebben
14-Alexandrite
(To:AS16)

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.

AS16
13-Aquamarine
(To:sebben)

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. 

sebben
14-Alexandrite
(To:AS16)

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
  }
}
AS16
13-Aquamarine
(To:sebben)

Great. Thank you so much for your help. 

Announcements

Top Tags