How set image source from JS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How set image source from JS
I would like to set the image source in JS but i can't seem to get it to work. I have tried all of these but non seem to work. But they also do not produce an error in the console.
$scope.view.wdg['image-1']['source'] = 'tech1en.png'; $scope.view.wdg['image-1']['source'] = 'resources/Uploaded/tech1en.png'; $scope.view.wdg['image-1']['source'] = 'app/resources/Uploaded/tech1en.png';If i use an application parameter to store the image source value (and then change that parameter with JS) and link that to the image source in Studio it works but this is an extra step i would like to avoid.
Solved! Go to Solution.
- Labels:
-
Coding
-
Troubleshooting
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @jmikesell,
Please use the below line to set the image source using JS for a mobile AR experience :
$scope.view.wdg['image-1']['imgsrc'] = 'app/resources/Uploaded/download.jpg';
Let me know if this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I've used this code successfully for setting the source for 3D images in experiences on the HoloLens:
$scope.setWidgetProp("instruction_image", "src", "app/resources/Uploaded/finished.png");
Hope this helps.
Allan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @jmikesell,
Please use the below line to set the image source using JS for a mobile AR experience :
$scope.view.wdg['image-1']['imgsrc'] = 'app/resources/Uploaded/download.jpg';
Let me know if this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator