Skip to main content
Participant
May 2, 2023
Answered

Change dynamic textbox background colour

  • May 2, 2023
  • 1 reply
  • 616 views

Any ideas how to make the text box display a background? The font changes but the background doesn't.

 if (displayedItem === _this.display.text) { 
     textBox.text = `${displayedItem} ${fuelOrder}`;     
  	 textBox.font = "23px Arial" // THIS WORKS
         textBox.background=true;
	 textBox.backgroundColor = "#00ff00";

Thanks!

    This topic has been closed for replies.
    Correct answer JoãoCésar17023019

    Hi.

     

    I don't think CreateJS - or even canvas - implements a background property or method for text fields.

     

    You'll have to do it manually by creating in author or run time a rectangle in the background that has the same size and position of the target text field instance.

     

    Regards,

    JC

    1 reply

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    May 2, 2023

    Hi.

     

    I don't think CreateJS - or even canvas - implements a background property or method for text fields.

     

    You'll have to do it manually by creating in author or run time a rectangle in the background that has the same size and position of the target text field instance.

     

    Regards,

    JC

    Participant
    May 2, 2023

    Thanks JC

    I ended up just hiding the thing behind which I was wanting to obscure.

    Kind regards 

    Matt

    JoãoCésar17023019
    Community Expert
    Community Expert
    May 2, 2023

    You're welcome!

     

    And thanks for letting us know.