Show
Ignore:
Timestamp:
06/29/08 01:22:57 (5 months ago)
Author:
thijs
Message:

Update for pygments sample (#259)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • examples/sandbox/pygment/flex/src/org/pyamf/examples/pygment/PygmentExample.as

    r1437 r1464  
    1111         
    1212        import mx.collections.ArrayCollection; 
    13         import mx.containers.ControlBar; 
    1413        import mx.controls.ComboBox; 
    1514        import mx.controls.RichTextEditor; 
    16         import mx.controls.TextInput; 
    1715        import mx.core.Application; 
    1816        import mx.events.FlexEvent; 
    1917        import mx.utils.ObjectUtil; 
    2018         
    21         /** 
    22          * This example is based on the Pygments Ajax demo on 
    23          * http://pygments.org/demo 
    24          *  
    25          * @since 0.3.1 
    26          */ 
    2719        public class PygmentExample extends Application 
    2820        { 
    2921                private var gateway:            NetConnection; 
    30                 private var fileGateway:        String; 
    31                 private var remoting:           String; 
     22                private var remoting:           String = "http://localhost:8000"; 
    3223                                 
    33                 public var uiBar:                       ControlBar; 
    3424                public var code_txt:            RichTextEditor; 
    35                 public var desc_txt:            TextInput; 
    3625                public var lang_cb:                     ComboBox; 
    37                 public var name_txt:            TextInput; 
    3826                 
    3927                [Bindable] 
     
    4432                        super(); 
    4533                         
    46                         remoting = "http://localhost:8000"; 
     34                        addEventListener( FlexEvent.APPLICATION_COMPLETE, initApp ); 
    4735                         
    48                         addEventListener( FlexEvent.APPLICATION_COMPLETE, initApp ); 
     36                        this.enabled = false; 
    4937                } 
    5038                 
    51                 private function initApp(event:FlexEvent):void 
     39                private function initApp(event:FlexEvent): void 
    5240                { 
    5341                        // Setup connection 
     
    6654                } 
    6755                 
    68                 public function submitCode():void 
     56                public function submitCode(): void 
    6957                { 
    7058                        var code:String = code_txt.text; 
     
    7866                    // result or fault condition that the service returns. 
    7967                    var responder:Responder = new Responder( onSubmitResult, onFault ); 
    80                      
     68 
    8169                    // Call remote service to fetch data 
    8270                    gateway.call( "pygment.highlight", responder, lang, code ); 
     
    8775                { 
    8876                        code_txt.text = ''; 
    89                         code_txt.enabled = true; 
    9077                } 
    9178                 
     
    10693        { 
    10794            // Notify the user of the problem 
    108             this.enabled = false; 
     95            this.enabled = true; 
    10996                code_txt.text = "Remoting error:\n\n" + ObjectUtil.toString( error ); 
    11097        }