topical media & game development

talk show tell print

#graphic-player-10-pixel-bender-cubes03.mx

#graphic-player-10-pixel-bender-cubes03.mx [swf] [flash] flex


  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
          applicationComplete="onApplicationComplete()">
  
          <mx:Script>
                  <![CDATA[
                          import flash.filters.*;
                          import flash.utils.ByteArray;                
  
                          //the file that contains the binary bytes of the PixelBender filter
                          [Embed("shaders/cubes03.pbj", mimeType="application/octet-stream")]
                          private var TestFilter:Class;                
  
                          private function onApplicationComplete():void
                          {
                                  //Pass the loaded filter to the Shader as a ByteArray
                                  var shader:Shader = new Shader(new TestFilter() as ByteArray);
  
                                  shader.data.size.value = [50.0];
                                  var filter:ShaderFilter = new ShaderFilter(shader);
  
                                  //add the filter to the image
                                  im.filters = [filter];
                          }
                  ]]>
          </mx:Script>
  
          <mx:Image right="288" left="40" top="26" bottom="108" id="im" source="@Embed(source='soutine.jpg')"/>
  </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.