Skip to main content
1-Visitor
January 4, 2021
Solved

Change a color of the 3D label via .js

  • January 4, 2021
  • 1 reply
  • 4135 views

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.

Best answer by dsgnrClarK

Hi, @MaximeDid 

 

Please try the attachment.

1 reply

16-Pearl
January 5, 2021

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.

MaximeDid1-VisitorAuthor
1-Visitor
January 5, 2021

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.

16-Pearl
January 5, 2021

Hi, @MaximeDid 

 

Please try the attachment.