[SOLVED] Defer your response, workarounds?

3.84K viewsCSS Questions
0

I’m trying to do the following;

When the selected track changes, change the colour of track 1 to yellow

Yes it’s just a test for now.

I’ve tried it several ways but I keep getting the error message

(nanoK Box) There's a problem with 'Action Block 1' in reaction 'Reaction Colour track' (from 'Song - selected track' listener) >>
>> Changes cannot be triggered by notifications. You will need to defer your response.

I’ve written the following Action block to try to work around it:


def set_song_track_color(song):
   song().tracks[0].color = 1676960
self.schedule_message(1000, set_song_track_color(self.song))

But I still get the same error. Why isn’t self.schedule_message working?

Creating a reaction that sets a modifier and then a 2nd reaction that detects the changed modifier and sets the track colour results in the same error.

JohnC Answered question
Attached Files:
0

While making a note of your comments Phil,
I just found a note to myself from a while ago:

A workaround of the defer issue is also to update a modifier value, then in a separate reaction, add a listener which waits for a change to that modifier and then update the UI in someway.

So it would look like this:
Reaction 1: – update ‘modifier 1’
Reaction 2: – do another UI event.

admin Changed status to publish
Attached Files:
You are viewing 1 out of 4 answers, click here to view all answers.