gogo
/**
* Copyright bkzen ( http://wonderfl.net/user/bkzen )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/mnRp
*/
package
{
import com.bit101.components.CheckBox;
import com.bit101.components.PushButton;
import flash.display.Sprite;
import flash.events.MouseEvent;
import org.si.sion.events.SiONEvent;
import org.si.sion.SiONData;
import org.si.sion.SiONDriver;
/**
* Go!Go!
* @author jc at bk-zen.com
*/
public class Test197 extends Sprite
{
public function Test197()
{
var sion: SiONDriver = new SiONDriver();
sion.autoStop = true;
var data: SiONData = sion.compile(MMLString);
var playBtn: PushButton = new PushButton(this, 10, 10, "Go!Go!", function(): void
{
sion.stop();
if (!playBtn.selected)
return;
sion.play(data);
tracks.forEach(function(check: CheckBox, index: int, v:*): void {
check.enabled = false;
if (!check.selected)
sion.sequencer.tracks[index].sequenceOff();
});
});
playBtn.toggle = true;
var i: int, n: int = data.sequenceCount;
var tracks: Vector.<CheckBox> = new Vector.<CheckBox>(n, true);
for (i = 0; i < n; i++)
{
var check: CheckBox = new CheckBox(this, 10, 40 + 20 * i, "track : " + i);
tracks[i] = check;
check.selected = i < 4;
}
sion.addEventListener(SiONEvent.STREAM_STOP, function(): void {
tracks.forEach(function(check: CheckBox, ...a): void { check.enabled = true; } );
playBtn.selected = false;
});
}
private const MMLString: String = <><![CDATA[
#WAVB0{00000000000000324354657F7F65433B3208000000082A54657F7F6543000000};
#WAVB1{7F7F7F7F7F7F00434300436E6E0000007F7F7F7F7F7F00000000000000000000};
#WAVB2{7F7F7F7F7F000000000000000000000054545454540000000000000000000000};
#WAVB3{7F7F7F7F7F7F7F7F000000000000000054545454545454540000000000000000};
t130l8o2%4@0 [c<c>]4[g<g>]4[f<f>]7g<g> [a|<a>]4<d>[e<e>]4[f<f>]6fc>l32g&a&b&<c&d&e&f&gl8 f4ef4cf2.r2c1;
t130l8o3%4@1v6 l1ggf..g4agaal8a4ra4ra2. rcd+4c1;
t130l8o3%4@1v6 l1<c>ba..b4<c>b<ccl8c4rc4rc2.> rcd+4c1;
t130l8o4k12%4@1v6 <[d>g<c>g<g>g<d>g<[3d>g<c>g<]g>g<d>g<d>g<c>g<edc>g<]> <f384&a384&b384&c16...>b&g&d&c&>g&e&c1;
t130l8o4k12%4@3[e4&>g<ere&>g<drdddeed|c1&c2r2r] g2..&grc2rccde4re4rc1;
t130l8o4k12%4@2 [x104c4&>g<crc&>gbrbbb<cc>bx117<|f1&f2r2r] <c2..&cr>f2r>x104aab<c4rc4r>f1;
]]></>;
}
}