- Timestamp:
- 06/29/08 01:22:57 (5 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
examples/sandbox/pygment/flex/src/org/pyamf/examples/pygment/PygmentExample.as
r1437 r1464 11 11 12 12 import mx.collections.ArrayCollection; 13 import mx.containers.ControlBar;14 13 import mx.controls.ComboBox; 15 14 import mx.controls.RichTextEditor; 16 import mx.controls.TextInput;17 15 import mx.core.Application; 18 16 import mx.events.FlexEvent; 19 17 import mx.utils.ObjectUtil; 20 18 21 /**22 * This example is based on the Pygments Ajax demo on23 * http://pygments.org/demo24 *25 * @since 0.3.126 */27 19 public class PygmentExample extends Application 28 20 { 29 21 private var gateway: NetConnection; 30 private var fileGateway: String; 31 private var remoting: String; 22 private var remoting: String = "http://localhost:8000"; 32 23 33 public var uiBar: ControlBar;34 24 public var code_txt: RichTextEditor; 35 public var desc_txt: TextInput;36 25 public var lang_cb: ComboBox; 37 public var name_txt: TextInput;38 26 39 27 [Bindable] … … 44 32 super(); 45 33 46 remoting = "http://localhost:8000";34 addEventListener( FlexEvent.APPLICATION_COMPLETE, initApp ); 47 35 48 addEventListener( FlexEvent.APPLICATION_COMPLETE, initApp );36 this.enabled = false; 49 37 } 50 38 51 private function initApp(event:FlexEvent): void39 private function initApp(event:FlexEvent): void 52 40 { 53 41 // Setup connection … … 66 54 } 67 55 68 public function submitCode(): void56 public function submitCode(): void 69 57 { 70 58 var code:String = code_txt.text; … … 78 66 // result or fault condition that the service returns. 79 67 var responder:Responder = new Responder( onSubmitResult, onFault ); 80 68 81 69 // Call remote service to fetch data 82 70 gateway.call( "pygment.highlight", responder, lang, code ); … … 87 75 { 88 76 code_txt.text = ''; 89 code_txt.enabled = true;90 77 } 91 78 … … 106 93 { 107 94 // Notify the user of the problem 108 this.enabled = false;95 this.enabled = true; 109 96 code_txt.text = "Remoting error:\n\n" + ObjectUtil.toString( error ); 110 97 }
