Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9313081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:47:30+00:00 2026-06-19T01:47:30+00:00

While my simplified test case (pasted below) is in Flex, my question is actually

  • 0

While my simplified test case (pasted below) is in Flex, my question is actually an ActionScript 3 one.

I have a small card game, where I currently draw the background as a not very exciting looking greenish radial gradient:

enter image description here

Here is my very simple test code (just put it into a new Flash Builder project):

TestBg.mxml:

<?xml version="1.0" encoding="utf-8"?>
<s:Application 
    xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" 
    xmlns:mx="library://ns.adobe.com/flex/mx"
    xmlns:comps="*">

    <comps:MyBg width="100%" height="100%" />

</s:Application>

MyBg.as (a custom component):

package {
    import flash.display.GradientType;
    import flash.display.InterpolationMethod;
    import flash.display.Shape;
    import flash.display.SpreadMethod;
    import flash.geom.Matrix;
    import mx.core.BitmapAsset;
    import mx.core.UIComponent;

    public class MyBg extends UIComponent {
        [Embed('bg.png')]
        private static const BG_ASSET:Class;
        private static const BG:BitmapAsset = new BG_ASSET() as BitmapAsset;

        private static const COLORS:Array = [0xCCFFCC, 0x669966];
        private static const ALPHAS:Array = [1, 1];
        private static const RATIOS:Array = [0, 255];

        private var _matrix:Matrix = new Matrix();
        private var _bg:Shape = new Shape();

        override protected function createChildren():void {
            super.createChildren();
            addChild(_bg);
        }

        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
            super.updateDisplayList(unscaledWidth, unscaledHeight);

            _bg.graphics.clear();
            //_bg.graphics.beginBitmapFill(BG.bitmapData);
            _matrix.createGradientBox(unscaledWidth, unscaledHeight, 0, 0, -unscaledHeight / 6);
            _bg.graphics.beginGradientFill(GradientType.RADIAL,
                COLORS,
                ALPHAS,
                RATIOS,
                _matrix,
                SpreadMethod.PAD,
                InterpolationMethod.LINEAR_RGB,
                0);
            _bg.graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
            _bg.graphics.endFill();
        }
    }
}

I would like to use a seamless tile instead of the gradient:

bg.png:

enter image description here

mask.png (currently not used):

enter image description here

to make my background look similar to the (arguably) good looking Apple Game Center shown at the bottom of this Stackoverflow question.

So I uncomment the beginBitmapFill call above and comment the beginGradientFill and get the following dark and dull looking background:

enter image description here

My question is: how to add a light spot to my background an make it look bit lighter overall?

Can I use the mask.png somehow for that or maybe some of the blendModes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T01:47:31+00:00Added an answer on June 19, 2026 at 1:47 am

    I would use two layers, a _bgTexture with just the texture as you have, and a _bgShading with some greyscale lighting above that based on your original, but with a blendMode of BlendMode.OVERLAY, then expand the radial gradient a bit to avoid the sharp edges and add an inner shadow.

    Just testing in the Flash IDE, I’ve used COLORS:Array = [0xDDDDDD, 0x777777], the texture exported as a BackgroundTexture class, and the following method based off your updateDisplayList to get this:

    Textured background with a lighting overlay.

    function drawBG(unscaledWidth:Number, unscaledHeight:Number):void {
        _bgShading.graphics.clear();
    
        _matrix.createGradientBox(unscaledWidth * 1.2, unscaledHeight * 2.2, 0, -unscaledWidth * 0.1, -unscaledHeight * 0.8);
        _bgShading.graphics.beginGradientFill(GradientType.RADIAL,
            COLORS,
            ALPHAS,
            RATIOS,
            _matrix,
            SpreadMethod.PAD,
            InterpolationMethod.LINEAR_RGB,
            0);
        _bgShading.graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
        _bgShading.graphics.endFill();
    
        _bgShading.filters = [new DropShadowFilter(0, 0, 0x000000, 1.0, 10.0, 10.0, 1.0, 3, true)];
    
        _bgTexture.graphics.clear();
        _bgTexture.graphics.beginBitmapFill(new BackgroundTexture());
        _bgTexture.graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
        _bgTexture.graphics.endFill();
    
        _bgShading.blendMode = BlendMode.OVERLAY;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have edited and simplified this question a lot. If I have this method
I have to use a recursive function in python, code below is a simplified
@Carlo V. Dango I have simplified my question and I have read the documentation--good
I have a table that simplified looks like this: create table Test ( ValidFrom
This is a simplified version of a class I'm writing a unit test for
I have code in a JS file that like this (simplified of course): $(function
I have been struggling with this for a while now, somehow JQuery is escaping
I have a unit test that I'd like to write for a function that
I have been pulling my hair out on this one all day, and I'm
I am using PHP 5.3.6 from MAMP . I have a use case where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.