<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Temporarily change button appearance for 2 seconds using Javascript in Vuforia Studio</title>
    <link>https://www.ptcusercommunity.com/t5/Vuforia-Studio/Temporarily-change-button-appearance-for-2-seconds-using/m-p/965570#M12599</link>
    <description>&lt;P&gt;to the 2D Image we need to use in the function instead of src property then the imgsrc property name. That is all so changing the method to that below in UI box - click event-&amp;nbsp; then will work&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;app.testPressed2dDelay('image-1',2000,'icon_freeze_inactive.png')&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;where the defintion of the function is that (only src was replaced with imgsrc - that is all&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;$scope.app.blocked2=false
...
...
$scope.app.testPressed2dDelay= (wdgName,delay,pressedPic) =&amp;gt; {
  
  if($scope.app.blocked2) return;
  $scope.app.blocked2=true
  
  let currentPicture = $scope.getWidgetProp(wdgName,'imgsrc')
    $scope.setWidgetProp(wdgName,'imgsrc',"app/resources/Uploaded/"+pressedPic)
   $scope.$applyAsync();        
 
    setTimeout( (wdgName,pic)=&amp;gt; { try{
                                                      
                                                      $scope.setWidgetProp(wdgName,'imgsrc',pic)
                                                        $scope.$applyAsync()
                                                        $scope.app.blocked2=false
                      
          
                          console.info("delay ="+delay+" &amp;gt; wdgName: "+wdgName+" to "+pic)
                          } catch(e){ console.error("outer",e);}    },delay, wdgName,currentPicture) 
                 
            
}&lt;/LI-CODE&gt;
&lt;P&gt;I will further with the toggle what should be done there and will provide an update&lt;/P&gt;</description>
    <pubDate>Thu, 08 Aug 2024 06:31:22 GMT</pubDate>
    <dc:creator>RolandRaytchev</dc:creator>
    <dc:date>2024-08-08T06:31:22Z</dc:date>
    <item>
      <title>Temporarily change button appearance for 2 seconds using Javascript</title>
      <link>https://www.ptcusercommunity.com/t5/Vuforia-Studio/Temporarily-change-button-appearance-for-2-seconds-using/m-p/964270#M12588</link>
      <description>&lt;P&gt;I would like to temporarily change a button's appearance for 2 seconds using Javascript. I'm planning to use the pre-built properties of "Image when Pressed" and Image when not Pressed" in Studio, if it makes sense. I need guidance on the javascript that could perform the temporary change. This provides user feedback when they press the button.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have attached two different icons that would change color/appearance to indicate to the user they have pressed the button.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am using Vuforia Studio 9.21.3.0&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2024 21:57:56 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Vuforia-Studio/Temporarily-change-button-appearance-for-2-seconds-using/m-p/964270#M12588</guid>
      <dc:creator>NJ_10402268</dc:creator>
      <dc:date>2024-07-30T21:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: Temporarily change button appearance for 2 seconds using Javascript</title>
      <link>https://www.ptcusercommunity.com/t5/Vuforia-Studio/Temporarily-change-button-appearance-for-2-seconds-using/m-p/965480#M12596</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/602779"&gt;@NJ_10402268&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I think there could be different approaches to&amp;nbsp; &amp;nbsp;implement the requested functionality . Here I want to provide one possible option:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;supposing you want to use 3DImage widget on mobile Vuforia Studio Project. So we use there the click event&amp;nbsp;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;where the function&amp;nbsp;will have as arguments the 3DImage widget name, the delay -2000ms - 2 seconds and the name of the picture what is inactive. the pictures file should be uploaded to the Project Upload folder&lt;LI-CODE lang="javascript"&gt;app.testPressedDelay('3DImage-1',2000,'icon_freeze_inactive.png')​​&lt;/LI-CODE&gt;
&lt;P&gt;The code for the call will be added to the UI click box of the 3DImage widget - here it is the 3DImage-1&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-08-07_16-39-31.jpg" style="width: 781px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/108859i2CFF8B3FA889EC82/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-08-07_16-39-31.jpg" alt="2024-08-07_16-39-31.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;It is important to block the action of the function during of the execution - 2 second . this could be done by global variable:&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;$scope.app.blocked=false​&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;​&lt;/P&gt;
&lt;P&gt;&amp;nbsp;where then in the function we will check something like&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;... 
... 
if($scope.app.blocked) return; 
$scope.app.blocked=true 
... 
...&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;at the end the complete code of that option&amp;nbsp; could be something like this:&lt;LI-CODE lang="javascript"&gt;//call from click event of the 3DImage
//app.testPressedDelay('3DImage-1',2000,'icon_freeze_inactive.png')
//=========================================
//blocks the event when it is called for the delay
$scope.app.blocked=false
//=========================================
$scope.app.testPressedDelay= (wdgName,delay,pressedPic) =&amp;gt; {
  
  if($scope.app.blocked) return;
  $scope.app.blocked=true
  
  let currentPicture = $scope.getWidgetProp(wdgName,'src')
    $scope.setWidgetProp(wdgName,'src',"app/resources/Uploaded/"+pressedPic)
   $scope.$applyAsync();        
 
    setTimeout( (wdgName,pic)=&amp;gt; { try{
                                                      
                                                      $scope.setWidgetProp(wdgName,'src',pic)
                                                        $scope.$applyAsync()
                                                        $scope.app.blocked=false
                      
          
                          console.info("delay ="+delay+" &amp;gt; wdgName: "+wdgName+" to "+pic)
                          } catch(e){ console.error("outer",e);}    },delay, wdgName,currentPicture) 
                 
            
}​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I attached also a s&lt;A href="https://community.ptc.com/sejnu66972/attachments/sejnu66972/studio/12596/1/ImagePressed_communty1.zip" target="_self"&gt;imple demo project&lt;/A&gt; to this post&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 14:56:01 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Vuforia-Studio/Temporarily-change-button-appearance-for-2-seconds-using/m-p/965480#M12596</guid>
      <dc:creator>RolandRaytchev</dc:creator>
      <dc:date>2024-08-07T14:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Temporarily change button appearance for 2 seconds using Javascript</title>
      <link>https://www.ptcusercommunity.com/t5/Vuforia-Studio/Temporarily-change-button-appearance-for-2-seconds-using/m-p/965525#M12597</link>
      <description>&lt;P&gt;Hi Roland,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the example and guidance. I appreciate it. However, I have tried to take your js and apply it to a 2d image or a toggle button, but the desired effects do not work. It doesn't appear that your code is specific to this example. It should translate to other click events or pressed events, right? I have attached my edit of your project.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 20:02:49 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Vuforia-Studio/Temporarily-change-button-appearance-for-2-seconds-using/m-p/965525#M12597</guid>
      <dc:creator>NJ_10402268</dc:creator>
      <dc:date>2024-08-07T20:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: Temporarily change button appearance for 2 seconds using Javascript</title>
      <link>https://www.ptcusercommunity.com/t5/Vuforia-Studio/Temporarily-change-button-appearance-for-2-seconds-using/m-p/965531#M12598</link>
      <description>&lt;P&gt;Will this code conflict with a toggle button already having binding to navigate within a model? I currently have rewind, play, and forward buttons in my experience and they all have bindings to the model.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="a10e3e28-7924-4f73-aea9-74b424d20aef.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/108868i9E5A2B826693182E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="a10e3e28-7924-4f73-aea9-74b424d20aef.png" alt="a10e3e28-7924-4f73-aea9-74b424d20aef.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="a4982034-55d3-4259-b742-d2b775ffa97d.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/108869i6205AF826F4E88F4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="a4982034-55d3-4259-b742-d2b775ffa97d.png" alt="a4982034-55d3-4259-b742-d2b775ffa97d.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 20:07:26 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Vuforia-Studio/Temporarily-change-button-appearance-for-2-seconds-using/m-p/965531#M12598</guid>
      <dc:creator>NJ_10402268</dc:creator>
      <dc:date>2024-08-07T20:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: Temporarily change button appearance for 2 seconds using Javascript</title>
      <link>https://www.ptcusercommunity.com/t5/Vuforia-Studio/Temporarily-change-button-appearance-for-2-seconds-using/m-p/965570#M12599</link>
      <description>&lt;P&gt;to the 2D Image we need to use in the function instead of src property then the imgsrc property name. That is all so changing the method to that below in UI box - click event-&amp;nbsp; then will work&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;app.testPressed2dDelay('image-1',2000,'icon_freeze_inactive.png')&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;where the defintion of the function is that (only src was replaced with imgsrc - that is all&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;$scope.app.blocked2=false
...
...
$scope.app.testPressed2dDelay= (wdgName,delay,pressedPic) =&amp;gt; {
  
  if($scope.app.blocked2) return;
  $scope.app.blocked2=true
  
  let currentPicture = $scope.getWidgetProp(wdgName,'imgsrc')
    $scope.setWidgetProp(wdgName,'imgsrc',"app/resources/Uploaded/"+pressedPic)
   $scope.$applyAsync();        
 
    setTimeout( (wdgName,pic)=&amp;gt; { try{
                                                      
                                                      $scope.setWidgetProp(wdgName,'imgsrc',pic)
                                                        $scope.$applyAsync()
                                                        $scope.app.blocked2=false
                      
          
                          console.info("delay ="+delay+" &amp;gt; wdgName: "+wdgName+" to "+pic)
                          } catch(e){ console.error("outer",e);}    },delay, wdgName,currentPicture) 
                 
            
}&lt;/LI-CODE&gt;
&lt;P&gt;I will further with the toggle what should be done there and will provide an update&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 06:31:22 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Vuforia-Studio/Temporarily-change-button-appearance-for-2-seconds-using/m-p/965570#M12599</guid>
      <dc:creator>RolandRaytchev</dc:creator>
      <dc:date>2024-08-08T06:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Temporarily change button appearance for 2 seconds using Javascript</title>
      <link>https://www.ptcusercommunity.com/t5/Vuforia-Studio/Temporarily-change-button-appearance-for-2-seconds-using/m-p/965595#M12600</link>
      <description>&lt;P&gt;I think for the 2D toggle widget we do not need to set the image property but simple used the pressed /notpressed property. Here in the example I used parameters which are bind to the properties and set the paramters instead of the property directly ,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-08-08_09-54-11.jpg" style="width: 999px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/108886iBB6C17A7C5F4DC7F/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-08-08_09-54-11.jpg" alt="2024-08-08_09-54-11.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;here the used approuch is to unpress the button after some timeout,- delay. That is all. If you do not want to colide with other click so you can do that also disable- but this is not really neccessarly so far I know. Here example of the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;/////////=================
$scope.app.testPressed2dToggleDelay= (wdgName,delay) =&amp;gt; {
  console.log("app.testPressed2dToggleDelay stared on click event with arg wdgName="+wdgName+", delay = "+delay)
 
 	$timeout((wdgName,delay)=&amp;gt;{
    if( !$scope.app.params['togg1pressed']  || !$scope.app.params['togg1disabled']  )return
   //============
  
     	$scope.app.params['togg1pressed']=false
   		$scope.$applyAsync()  
   		$scope.app.params['togg1disabled']=false       
     	$scope.$applyAsync()              
   
   		 $timeout( (wdgName)=&amp;gt; { try{  $scope.app.params['togg1disabled']=true  
                                                     $scope.$applyAsync()  
                                                     $scope.app.params['togg1pressed']=true
                                                     $scope.$applyAsync()          
                                                     console.log ("set parameters  togg1disabled="+$scope.app.params['togg1disabled']+" &amp;lt;&amp;gt;  togg1pressed="+$scope.app.params['togg1pressed'])
                         								 } 
                                                      catch(e){ console.error("outer",e);}    },delay, true,wdgName) 
                 
     },150,true,wdgName,delay) //this is delay of the function not to colide witht he pressed event

}
  &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I attached also the updated &lt;A href="https://community.ptc.com/sejnu66972/attachments/sejnu66972/studio/12600/1/ImagePressed_communty2.zip" target="_self"&gt;project 2 with the new test code&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 08:00:22 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Vuforia-Studio/Temporarily-change-button-appearance-for-2-seconds-using/m-p/965595#M12600</guid>
      <dc:creator>RolandRaytchev</dc:creator>
      <dc:date>2024-08-08T08:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Temporarily change button appearance for 2 seconds using Javascript</title>
      <link>https://www.ptcusercommunity.com/t5/Vuforia-Studio/Temporarily-change-button-appearance-for-2-seconds-using/m-p/965932#M12601</link>
      <description>&lt;P&gt;Hi Roland,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for working this out! This does successfully work for a singular button;however, my goal is to be able to have 4 toggle buttons all with different functions. Currently, the function activates all toggle buttons at the same time, even though the Studio IDs are different. I thought I could take the functions, rename them, and make new parameters for each button; but, that did not work. How would you edit the function so 4 toggle buttons could perform the same effect independently of each other?&lt;BR /&gt;&lt;BR /&gt;Sorry, but I have no knoweldge of javascript so I am making best guesses :).&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2024 14:50:32 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Vuforia-Studio/Temporarily-change-button-appearance-for-2-seconds-using/m-p/965932#M12601</guid>
      <dc:creator>NJ_10402268</dc:creator>
      <dc:date>2024-08-09T14:50:32Z</dc:date>
    </item>
  </channel>
</rss>

