Skip to main content
Participant
May 2, 2023 10:51 AM UTC
Answered

Change dynamic textbox background colour

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 is closed to new replies. Start a new post to keep the conversation going.
    JoãoCésar17023019
    JoãoCésar17023019Correct answer
    Community Expert
    May 2, 2023 2:07 PM UTC

    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

    3 replies

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    May 2, 2023 2:07 PM UTC

    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

    Translate
    Participant
    May 2, 2023 6:03 PM UTC

    Thanks JC

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

    Kind regards 

    Matt

    Translate
    JoãoCésar17023019
    Community Expert
    Community Expert
    May 2, 2023 6:13 PM UTC

    You're welcome!

     

    And thanks for letting us know.

    Translate