topical media & game development

talk show tell print

#graphic-player-10-cube-be-nascom-flash10-tests-widgets-CubeSimpleShadeMaterial.ax

#graphic-player-10-cube-be-nascom-flash10-tests-widgets-CubeSimpleShadeMaterial.ax [swf] [flash] flex


  package be.nascom.flash10_tests.widgets{
          
          import flash.display.Shape;
          import flash.display.Sprite;
  
          public class @ax-graphic-player-10-cube-be-nascom-flash10-tests-widgets-CubeSimpleShadeMaterial extends Sprite implements ISimpleShaderMaterial{
                  
                  protected var _side_width:Number;
                  protected var _side_height:Number;
                  protected var _half_width:int;
                  protected var _half_height:int;                
                  
                  protected var _simple_button:CubeSideMaterial;
                  protected var _shader_shape:Shape;
                  
                  public function @ax-graphic-player-10-cube-be-nascom-flash10-tests-widgets-CubeSimpleShadeMaterial(w:uint,h:uint,side_id:uint){
                          _simple_button=new CubeSideMaterial(w,h,side_id,true,0xFFFFFF,0xBBBBFF,0x7777FF);
                          addChild(_simple_button);
                          _shader_shape=new Shape();
                          _side_width=w;
                          _side_height=h;
                          _half_width=Math.round(-w/2);
                          _half_height=Math.round(-h/2);
                          this.addChild(_shader_shape);
                  }
                  
                  //expectes number between 0 and 1
                  public function updateShader(value:Number):void{
                          if(value<0)value=0;
                          if(value>1)value=1;
                          _shader_shape.graphics.clear();
                          _shader_shape.graphics.beginFill(0x000000,value);
                          _shader_shape.graphics.drawRect(_half_width,_half_height,this._side_width,this._side_height);
                          _shader_shape.graphics.endFill();
                  }
                  
  
                  
                  
                  
                  
          }
  }


(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.