Skip to main content
Jan 4, 2021 4:39 PM UTC
Solved

Change a color of the 3D label via .js

Hi,

How can I change a color of a 3D label by clicking on a button?

I tried to write the code below but it doesn't work:

 

$scope.SwitchConf = function () {
$scope.app.view.Home.wdg["3DLabel-2"].fontColor= 'red';

 

When I click on the button, the function "SwitchConf" is called but the color don't change.

Is it possible to do this by this way?

Thanks for your help...

Maxime.

Jan 5, 2021 8:45 AM UTC

Hi, @MaximeDid 

 

Please try the attachment.

10 replies

Jan 5, 2021 1:52 AM UTC

Hi, Maxime

 

What type of project did you create? Mobile or 3D eyewear?

 

I tried both codes below  and they work in my mobile project, in preview and on device.

$scope.setColorRGB = function(){
 $scope.view.wdg['3DLabel-1'].fontColor = "#ff0000";
}

or

$scope.setColorName = function(){
 $scope.view.wdg['3DLabel-1'].fontColor = "red";
}

 

Have you tried the code on device?

Sometimes it doesn't work in preview, but works on device.

MaximeDidAuthor
Jan 5, 2021 8:02 AM UTC

Hi @dsgnrClarK ,

 

I created a mobile project.

I tried both code you send me, but in my app it doesn't works (in preview and on device).

I created also a new project and test the code but it doesn't work

 

I changed the code for check my function is called:

 

$scope.SwitchConf = function () {$scope.view.wdg['3DLabel-2'].visible = false;}

 

The result is OK.

Jan 5, 2021 8:45 AM UTC

Hi, @MaximeDid 

 

Please try the attachment.