Showing posts with label flex. Show all posts
Showing posts with label flex. Show all posts

May 7, 2010

Fix Pixelbender Shader Compile Errors

Today, I had a small pixelbender issue that I faced once before and forgot about it until I found the solution. Since this is the second time I've faced this, I decided to record the solution here.

Problem

Flex code, related to PixelBender, isn't compiling.

Symptoms

In Flex Builder / Flash Builder, I get the following errors:

  • 1046: Type was not found or was not a compile-time constant: Shader.
  • 1046: Type was not found or was not a compile-time constant: ShaderFilter.
  • 1172: Definition flash.display:Shader could not be found.
  • 1172: Definition flash.filters.ShaderFilter could not be found.
  • 1180: Call to a possibly undefined method Shader.
  • 1180: Call to a possibly undefined method ShaderFilter.

Solution

Clearly, these errors make no sense because both Shader and ShaderFilter are built-in classes distributed with Flash. Luckily, the solution is simple--you have to adjust your target Flash Player version. Make sure it's at least version 10:
  1. Right click your project and choose properties
  2. Go to the Flex Compiler section
  3. At the bottom, in the HTML wrapper section, check the Require Flash Player version box (which requires the Generate HTML wrapper file box to be checked)
  4. Enter at least version 10.0.0
  5. Celebrate!
That's it. Here's a picture!