Hi,
I am currently storing my StaveNote objects in an array and stuffing that into a variable for later access. I run a function createNotes, like this:
var notes = createNotes(clef, note_data);
Then I do something like:
var voice = new Vex.Flow.Voice({num_beats: 4, beat_value: 4, resolution: Vex.Flow.RESOLUTION});
voice.addTickables(notes);
// Format and draw
Vex.Flow.Formatter.FormatAndDraw(ctx, stave, notes);
I suspect this is not the best way to store StaveNote objects for later access, however. I have some user interaction, such as setting the colour of the note on mouse click, which I've been doing like this:
note.setStyle({fillStyle: "blue", strokeStyle: "blue"});
Where note is one of my stored StaveNotes. This does not work, however, unless I immediately call:
note.draw();
Also if I try and access the bounding box of the notehead of one of my stored notes I get an error, "Can't call getBoundingBox on an unformatted note."
So, I guess I need to access notes in a different way?
C