topical media & game development

talk show tell print

hush-config.mx

hush-config.mx [swf] [flash] flex


  <?xml version="1.0" encoding="utf-8"?>
  <mx:Application 
      xmlns:mx="http://www.adobe.com/2006/mxml" 
      width="100%" height="100%"
      horizontalAlign="center" verticalAlign="middle" 
      creationComplete="init()"
  >
  
      <mx:Script>
          <![CDATA[
              import flash.events.MouseEvent;
       
              [Bindable] public var config:String = "config.xml";
              private var xml:XML;
              private var urlLoader:URLLoader = new URLLoader();
              [Bindable] public var hello:String = "hello (default) world";
              [Bindable] public var message:String = "(default) world";
              [Bindable] public var button:String = "(default) click me!";
  
              private function init():void {
              config = Application.application.parameters.config;
              urlLoader.addEventListener(Event.COMPLETE,loaded);
              urlLoader.load(new  URLRequest(config));
              }
  
              private function loaded(e:Event):void{
              xml =  new XML(e.target.data);
              button = xml..button.@text;
              message = xml..button.@panel;
              hello = xml..button;
              //trace(xml);
              }
  
              private function handler ( event:MouseEvent ):void
              {
                  field.text = hello;
              }
          ]]>
      </mx:Script>
  
      
      <mx:Panel 
          title="{message}" horizontalAlign="center"
          paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10" 
      >
          <mx:Label id="field" width="180" fontWeight="bold" fontSize="24"/>
          <mx:Button label="{button}" click="handler(event);" />
      </mx:Panel>
  </mx:Application>
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.