Created
August 8, 2011 22:21
-
-
Save davisford/1132893 to your computer and use it in GitHub Desktop.
Simple UI to toggle LED state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<s:Module xmlns:fx="http://ns.adobe.com/mxml/2009" | |
xmlns:s="library://ns.adobe.com/flex/spark" | |
xmlns:mx="library://ns.adobe.com/flex/mx" | |
xmlns:swiz="http://swiz.swizframework.org" | |
backgroundColor="#bdcdf4" | |
width="100%" height="100%" > | |
<fx:Script> | |
<![CDATA[ | |
import daisyworks.event.BluetoothTxRxEvent; | |
private function checkbox_changeHandler(event:Event):void { | |
if(checkbox.selected) { | |
// turn it off | |
dispatchEvent(new BluetoothTxRxEvent(BluetoothTxRxEvent.TX, "5;")); | |
} else { | |
// turn it on | |
dispatchEvent(new BluetoothTxRxEvent(BluetoothTxRxEvent.TX, "4;")); | |
} | |
} | |
]]> | |
</fx:Script> | |
<fx:Declarations> | |
<swiz:Swiz> | |
<swiz:config> | |
<swiz:SwizConfig eventPackages="daisyworks.event.*" | |
viewPackages="modules.*"/> | |
</swiz:config> | |
</swiz:Swiz> | |
</fx:Declarations> | |
<s:Group left="15" right="15" top="15" bottom="15"> | |
<s:layout> | |
<s:VerticalLayout /> | |
</s:layout> | |
<s:Label text="Daisy Blink / LED App" width="100%" height="85" paddingTop="44" textAlign="center" fontSize="24" fontWeight="bold" fontFamily="Verdana"/> | |
<s:HGroup width="100%" height="128" verticalAlign="middle" horizontalAlign="center"> | |
<s:CheckBox id="checkbox" change="checkbox_changeHandler(event)" label="LED State" height="35" fontSize="15" width="150"/> | |
</s:HGroup> | |
</s:Group> | |
</s:Module> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment