<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
minWidth="1024" minHeight="768" width="213" height="40" viewSourceURL="srcview/index.html">
<fx:Script>
<![CDATA[
import components.SquareWaveSound;
import mx.events.FlexEvent;
private var Hz220:SquareWaveSound = new SquareWaveSound(220);
private var Hz440:SquareWaveSound = new SquareWaveSound(440);
protected function btn220_clickHandler(event:MouseEvent):void
{
if (Hz220.isOn) {
Hz220.stop();
btn220.label = "Play";
} else {
Hz220.start();
btn220.label = "Stop";
}
}
protected function btn440_clickHandler(event:MouseEvent):void
{
if (Hz440.isOn) {
Hz440.stop();
btn440.label = "Play";
} else {
Hz440.start();
btn440.label = "Stop";
}
}
]]>
</fx:Script>
<s:Button id="btn220" x="10" y="10" label="Play" click="btn220_clickHandler(event)"/>
<s:Button id="btn440" x="118" y="10" label="Play" click="btn440_clickHandler(event)"/>
</s:Application>