Starling filters createGlow()

I have been trying to apply a glow filter to an image but the glow always ends up in a square with no soft edges. What is the proper way to apply a filter?

It sounds like you need to make a bigger image. Starling claims that the Image class works like a Bitmap in AS3 or OpenFL, and what you described makes it sound like the glow is being cut off at the edges of a bitmap.

I haven’t actually used Starling myself, but it looks like you could fix this with Texture.fromTexture(), by passing a large rectangle for region or frame (not sure which; just try both). The new texture will have the same content as the old one, except with extra space around the edges. Then make an Image object from the new texture, and apply the filter to that.

Nope that did not work. The starling demo works just fine but when I try to apply the same concept to my project it does not work.

In situations like this, there’s a simple way to figure out what’s wrong. (Not necessarily quick, just simple.)

First, make a backup copy of your project. If you’re using a version control system like Git, just make sure everything is committed or stashed. The important thing is being able to undo the changes you’ll be making.

Second, start trying to make the projects more like one another. You can start at either end, meaning you can either:

  • Copy lines from your main project into the sample project (adjusting variable names) until the sample project has the same features as your main project.
  • Delete lines from your main project to reduce its functionality to match the sample project.

Compile regularly, and remember what you just changed. When the sample app stops working or your project starts working, you’ll know which lines of code made the difference. Repeat the process on those lines of code until you narrow it down to a single line.