Remove all lines containing cvs/svn "$Id$" keyword.
[wxWidgets.git] / samples / flash / form.mxml
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
10  This file can be compiled to SWF using the mxmlc free compiler from Flex SDK.
11
12  You then can call SetText() and GetText() functions from the C++ flash sample.
13  -->
14 <mx:Application
15    xmlns:mx="http://www.adobe.com/2006/mxml"
16    xmlns:adl="*"
17    preinitialize="preinit();"
18    horizontalAlign="left" verticalAlign="top" 
19    layout="absolute"
20    backgroundAlpha="1" 
21    backgroundColor="0xaaaaaa"
22    width="100%">
23 <mx:Script>
24 <![CDATA[
25 import flash.external.ExternalInterface;
26
27 private function preinit():void
28 {
29     ExternalInterface.addCallback("SetText", DoSetText);
30     ExternalInterface.addCallback("GetText", DoGetText);
31 }
32
33 private function DoSetText(str: String):void {
34     txt.text = str;
35 }
36
37 private function DoGetText():String {
38     return txt.text;
39 }
40
41 public function onok():void {
42     fscommand("call_fscommand_form", "button");
43 }
44 ]]>
45 </mx:Script>
46 <mx:Canvas width="100%">
47     <mx:VBox width="100%">
48         <mx:Form borderColor="0x0" borderStyle="solid" width="100%">
49             <mx:Label text="Simple Flash Form" />
50             <mx:FormItem label="Type any text here:">
51                 <mx:TextInput id="txt" text="Hello wxWidgets!" width="100%"/>
52             </mx:FormItem>
53             <mx:FormItem label="Click button to generate event">
54                 <mx:Button id="formbutton" label="OK" click="onok();"/>
55             </mx:FormItem>
56         </mx:Form>
57     </mx:VBox>
58 </mx:Canvas>
59 </mx:Application>