Идея такова: есть три кнопки Запись, Стоп, Play.
Кликаю на Запись, жму\отпускаю клавишу f, в соответствии с мелодией
(я тестировал на мелодии из фильма Охотники за привидениями),
потом жму Стоп, мелодия записалась.
Дальше жму Play, то, что я записал, воспроизводится файлом 1.mp3 (щелчок).
Всё работает, но проблема в том, что мелодии не получается.
Допустим есть wave-файл, и я его аудио конвертером перегоню в midi, и будет мелодия.
А у меня никакой мелодии не выходит.
IDE: Adobe Flash Professional CS5
Язык: AS3
Код: Выделить всё
import flash.media.ID3Info;import flash.media.Sound;import flash.media.SoundLoaderContext; /* Mouse Click EventClicking on the specified symbol instance executes a function in which you can add your own custom code. Instructions:1. Add your custom code on a new line after the line that says "// Start your custom code" below.The code will execute when the symbol instance is clicked.*/var start_pos:Array = new Array();var end_pos:Array = new Array();var q:Number = 0;var id:Number;rec_btn.addEventListener(MouseEvent.CLICK, rec_btn_click);stop_btn.addEventListener(MouseEvent.CLICK, stop_btn_click);play_btn.addEventListener(MouseEvent.CLICK, play_btn_click); function rec_btn_click(event:MouseEvent):void{ id = setInterval(function() {q++},1); stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_KeyboardDownHandler); stage.addEventListener(KeyboardEvent.KEY_UP, fl_KeyboardUpHandler); }function stop_btn_click(event:MouseEvent):void{ clearInterval(id); stage.removeEventListener(KeyboardEvent.KEY_DOWN, fl_KeyboardDownHandler); stage.removeEventListener(KeyboardEvent.KEY_UP, fl_KeyboardUpHandler);}function play_btn_click(event:MouseEvent):void{ q = 0; var q1 = 0; id = setInterval(function() { q++; if (q==start_pos[q1]){snd.play();q1++;} },1);} function fl_KeyboardDownHandler(event:KeyboardEvent):void{ //trace("Key Code Pressed: " + event.keyCode); //клавиша f if (event.keyCode == 70) { trace(q); start_pos.push(q); snd.play(); }}function fl_KeyboardUpHandler(event:KeyboardEvent):void{ //trace("Key Code Pressed: " + event.keyCode); if (event.keyCode == 70) { trace(q); end_pos.push(q); }} var snd:Sound = new Sound();var req:URLRequest = new URLRequest("1.mp3");var context:SoundLoaderContext = new SoundLoaderContext(3000,false); snd.load(req, context);snd.play();snd.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);function errorHandler(errorEvent:IOErrorEvent):void{ trace("The sound could not be loaded: " + errorEvent.text);}
http://www.flasher.ru/forum/attachment. ... 1312063884