2

OK, so it blows my mind, so help me please, I'd like to use a transparent quad in my starling project, it has a property: color of ARGB, so I set the alpha to 90 for example, but it just doesn't seem to work like that. now I've changed it's blend mode to MULTIPLY, so it works, but I'm not sure it's the good solution, maybe with other colored background, it won't look like, as I want, I want it a bit grey, so the user knows, he can't acces the stage, at the minute. So is there any other, better solution than this? Thank you, here's my code

package screens 
{
    import starling.display.Image;
    import starling.display.Quad;
    import starling.display.BlendMode

public class TransparentScr extends AbstractScr{
    private var trpImg:Image;

    public function TransparentScr() {
        super();
    }

    override protected function init():void {
        super.init();
        var quad:Quad = new Quad(Main.STAGE_WIDTH / 2, Main.STAGE_HEIGHT / 2, 0x90cccccc, true);
        quad.blendMode = BlendMode.MULTIPLY;
        addChild(quad);
    }

}

}

Nico Schlömer
  • 53,797
  • 27
  • 201
  • 249
Ferenc Dajka
  • 1,052
  • 3
  • 17
  • 45

2 Answers2

2

so I set the alpha to 90

In Starling, alpha values go from 0.0 to 1.0. Assuming that you want 90% opacity, you should use 0.9.

Josh Tynjala
  • 5,235
  • 3
  • 23
  • 25
1

I think you can only use the Quad to make it transparent. As far as making it monochrome, I I would recommend a ColorMatrixFilter:

var mat:Array = [ 
          .33,.33,.33,0,0,
          .33,.33,.33,0,0,
          .33,.33,.33,0,0,
          .33,.33,.33,1,0 ];
var colorMat:ColorMatrixFilter = new ColorMatrixFilter(mat);
this.filters = [colorMat];
AturSams
  • 7,568
  • 18
  • 64
  • 98
  • thanks man, too bad there is no filters property in starling's displayobjects, anyways, I'm going to use the blendmode than, thanks anyways – Ferenc Dajka Sep 30 '12 at 11:54
  • Oh, good to know.. if you are loading it from an image(bitmapData) you can use the filter on the image like this: bitmapData.applyFilter(); to create a grayscale copy. – AturSams Sep 30 '12 at 12:17
  • okay thanks for the help, I will use the multiply blend mode, like this solution better – Ferenc Dajka Sep 30 '12 at 18:18