How can I update the LabelLetters label after creation?

I'm using LabelLetters with a label to do HTML style text. It works great! However, I'm updating the label content very regularly. I update content of a the label and do stage.update(); afterwards, but it's not updating. What else do I need to do?

this.coolLabel = ' Something';

this.coolText = new LabelLetters({
label: this.coolLabel,
letterSpacing:0,
lineSpacing:0,
lineAlign:LEFT,
}).loc(310,342,mc);

...a few seconds later....

this.coolLabel = ' Something else';

stage.update();

Welcome Matthew! Please make a profile for yourself.

Here is an example of using a function to remake the LabelLetters - which is what we would have to do internally if we provided both a read and write property. Maybe we should do that... will add it to requests.

const text = new Container().center();

function makeText(text, container, align) {
    container.disposeAllChildren();
    let coolText = new LabelLetters({
        label: text,
        letterSpacing:50,
        lineSpacing:0,
        lineAlign:LEFT,
    }).pos(0,0,align,TOP,container);
    S.update();
}
    
makeText("Something", text, CENTER);
timeout(2, ()=>{
    makeText("Changed Text", text, CENTER);
});

PERFECT! Thank you!

1 Like