Scroll:bit coding help wanted

Hi all, I am trying to use a scroll;bit to display different messages depending on which button has been pressed. I want each message to be scrolled multiple times (ideally as a continuous loop). My base code in java to display each message twice is:

input.onButtonPressed(Button.A, function () {
for (let i = 0; i < 2; i++) {
scrollbit.scrollText(“one”, 128, 50)
}
})
input.onButtonPressed(Button.B, function () {
for (let i = 0; i < 2; i++) {
scrollbit.scrollText(“two”, 128, 50)
}
})

The " for (let) " line controls the number of time the message is scolled.
If I change it to " while (true) " when I restart the micro:bit and press one of the buttons I get continuous scrolling but pressing the other button doesn’t change the message I have to reset first!

input.onButtonPressed(Button.A, function () {
while (true) {
scrollbit.scrollText(“one”, 128, 50)
}
})
input.onButtonPressed(Button.B, function () {
while (true) {
scrollbit.scrollText(“two”, 128, 50)
}
})

Its like once the first button has been pressed the micro:bit stops ‘listening’ for any other inputs (i.e. the other button being pressed).

Any help gratefully recieved!
Andrew

Micro Python?

If input.onButtonPressed

elif input.onButtonPressed

Maybe?

I do believe there can be only one While true loop.

I have a Micro-bit, several actually, haven’t done anything with them in a long while. I don’t have the scroll bit though. Might be able to play around with the button part of the code though, latter on today.
Three ``` before and after your posted code will put it in code tags.
It’s the symbol on the ~ key, under the ~.

This is a python file I did up for my Micro-Bit that uses the A & B buttons. I hope it helps.

# Add your Python code here. E.g.

from microbit import *
import microbit
import music

cake = Image("09090:"
             "07070:"
             "55555:"
             "50005:"
             "55555")

while True:

    if microbit.button_a.is_pressed():
        display.show(cake)
        music.play(music.BIRTHDAY,pin=microbit.pin0, wait=True, loop=False)
        #sleep(9000)
    elif microbit.button_b.is_pressed():
        display.scroll("60")
        display.show(Image.SAD)
        music.play(music.WAWAWAWAA,pin=microbit.pin0, wait=True, loop=False)
    else:
        display.show(Image.HAPPY)