form.mxml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!--
  3. Name: form.mxml
  4. Purpose: Simple form in Flash
  5. Author: Vadim Zeitlin
  6. Created: 2009-01-13
  7. Copyright: (c) 2009 Vadim Zeitlin
  8. Licence: wxWindows licence
  9. This file can be compiled to SWF using the mxmlc free compiler from Flex SDK.
  10. You then can call SetText() and GetText() functions from the C++ flash sample.
  11. -->
  12. <mx:Application
  13. xmlns:mx="http://www.adobe.com/2006/mxml"
  14. xmlns:adl="*"
  15. preinitialize="preinit();"
  16. horizontalAlign="left" verticalAlign="top"
  17. layout="absolute"
  18. backgroundAlpha="1"
  19. backgroundColor="0xaaaaaa"
  20. width="100%">
  21. <mx:Script>
  22. <![CDATA[
  23. import flash.external.ExternalInterface;
  24. private function preinit():void
  25. {
  26. ExternalInterface.addCallback("SetText", DoSetText);
  27. ExternalInterface.addCallback("GetText", DoGetText);
  28. }
  29. private function DoSetText(str: String):void {
  30. txt.text = str;
  31. }
  32. private function DoGetText():String {
  33. return txt.text;
  34. }
  35. public function onok():void {
  36. fscommand("call_fscommand_form", "button");
  37. }
  38. ]]>
  39. </mx:Script>
  40. <mx:Canvas width="100%">
  41. <mx:VBox width="100%">
  42. <mx:Form borderColor="0x0" borderStyle="solid" width="100%">
  43. <mx:Label text="Simple Flash Form" />
  44. <mx:FormItem label="Type any text here:">
  45. <mx:TextInput id="txt" text="Hello wxWidgets!" width="100%"/>
  46. </mx:FormItem>
  47. <mx:FormItem label="Click button to generate event">
  48. <mx:Button id="formbutton" label="OK" click="onok();"/>
  49. </mx:FormItem>
  50. </mx:Form>
  51. </mx:VBox>
  52. </mx:Canvas>
  53. </mx:Application>