topical media & game development

talk show tell print

#graphic-player-10-cube-FP10TestRunner.mx

#graphic-player-10-cube-FP10TestRunner.mx [swf] [flash] flex


  <?xml version="1.0" encoding="utf-8"?>
  <mx:Application 
          xmlns:mx="http://www.adobe.com/2006/mxml"
          xmlns:nas_comp="be.nascom.flex.component.*"
          layout="absolute" frameRate="31"
           backgroundColor="0xFFFFFF" backgroundGradientColors="[0xB3191E,0xDE1F26]"
          applicationComplete="init();" >
          
          <mx:Script>
                  <![CDATA[
   // <red>lookat blog</red>: http://www.nascom.be/404/fp10-3d-features-partii-z-sorting-truly-simple-shader-nested-perspective
  
  
  			import mx.collections.ArrayCollection;
  
                          import be.nascom.flex.component.FlexSimpleTraceBox;
                      import be.nascom.flash.component.SimpleStatsView;
                      import be.nascom.flash10_tests.*;//yeah yeah yeah, NO WILDCARD IMPORTS?! OMG?! this is not a mission critical app simultaniously developed by a 1000 rocket scientists ;)
      
                          [Embed (source="graphic-player-10-cube-assets-nascom.png")]
                          private var NascomLogo:Class;
      
                      //create a new test in be.nascom.flash10_tests, and add to this array collection
                      [Bindable]
                      public var tests_list:ArrayCollection=new ArrayCollection(        [
                                                                                                                                                      {name:"1) Rotation3dBehaviour",test_class:Rotation3dBehaviour},
                                                                                                                                                      {name:"2) Performance3dTest1",test_class:Performance3dTest1},
                                                                                                                                                      {name:"3) CubeTest",test_class:CubeTest},
                                                                                                                                                      {name:"4) CubeTestZsorting",test_class:CubeTestZsorting},
                                                                                                                                                      {name:"5) NestedPerspectiveTest",test_class:NestedPerspectiveTest},
                                                                                                                                                      {name:"6) CubeCheapShading",test_class:CubeCheapShading}
                                                                                                                                              ]);
          
                          public var current_test:AbstractFP10Test;
          
                          public function init():void{
                                  //FlexSimpleTraceBox.
                                  var s:SimpleStatsView=new SimpleStatsView(0xFFFFFF,0xB3191E);
                                  stats_holder.addChild(s);
                          }
                          
                          
                          
                          public function runTest():void{
                                  //remove previous test
                                  //it's up to the developer of the test to ensure that IFlashTest.destroy() cleans up shop properly
                                  if(current_test!=null){
                                          current_test.destroy();
                                          removeChild(current_test);
                                  }
                                  current_test_label.text=tests_cb.selectedItem.name;
                                  var test_class:Class=tests_cb.selectedItem.test_class;
                                  current_test=new test_class();
                                  addChild(current_test);
                                  current_test.y=140;
                                  current_test.run();
                                  notes.htmlText=current_test.getNotes();
                          }        
          
                          
                  ]]>
          </mx:Script>
          
          <mx:HBox top="10" left="10" color="0xFFFFFF" fontWeight="bold" fontFamily="Verdana" >
                  <mx:Image source="@Embed('graphic-player-10-cube-assets-nascom.png')" />
                  <mx:ComboBox id="tests_cb" dataProvider="{tests_list}" labelField="name" color="0x000000" rowCount="15" />
                  <mx:Button label="run!" click="runTest()" />
                  <mx:Label text="current test:" paddingTop="2" />
                  <mx:Label id="current_test_label" width="150" paddingTop="2" />
          </mx:HBox>
          <mx:TextArea         id="notes" text="Choose a test above and click 'run'" borderColor="0xFFFFFF"
                                          x="10" y="40" backgroundAlpha="0" color="0x000000" fontWeight="bold" 
                                          fontFamily="Verdana" fontSize="12" width="800" height="100" />
  
          <mx:UIComponent id="stats_holder" right="140" top="10"  />
          <nas_comp:FlexSimpleTraceBoxConsole right="5" top="100" width="400" height="700" />        
          
  </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.