Frage

After searching the net high and low, I just cannot for the life of me figure this out. I'm definitely a newbie with all things Flash, but I'm teaching myself where I can. I've gotten a simple Flash piano working, and would like to add record & play back functions. This is where the problem comes in- I can find any multitude of answers for recording from the microphone and saving/playing it back with Flash, but the only things I can find relating to internal audio (or Flash-based pianos) at all are questions like this one with either really vague answers or just no answers at all.

I have some sort of idea that I should be creating an array that tracks the clicks? (It's a mouse-playable piano at the moment, but if it's better for me to make it keyboard-based, that's something I can do at least). After (before? during?) creating that array, how do I keep the rhythm/timing correct?

I'm just super lost and really need your expertise...

War es hilfreich?

Lösung

You're on the right track in storing the clicks in an array. As far as rhythm and timing, when the user wants to start "recording" you can start a timer, I'd every 200ms or so. You can use that timer to determine at what point in time the key was clicked for use when playing it back.

I don't know if something like a long press is something you'd need, but to do that, with the same timer, you can set a start time and end time (press-->release) and just subtract the end time from the start time and now you have the duration of how long the key was pressed

EDIT: here is a quick example of what I was referring to in my original post: http://ronnieswietek.com/piano/piano_example.swf

the source: http://ronnieswietek.com/piano/piano_example.fla

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top