tiled background + gradient in flash

Posted on 2009-04-30
Last Modified: 2012-05-06
How would i go about doing something like this using actionscript 3? I tried google but couldn't get anything for the gradient overlay i'm guessing just a transparent png or something like that which goes over the background?
Question by:Abyssmal
    LVL 8

    Expert Comment

    You don't need a transparent png to accomplish this look. You simply need a graphic with a gradient that fades from an alpha of 0 to an alpha of 1 covering a background image and then set the gradient as a mask.

    So you could set up a graphic (square) with a radial gradient (from the color window). On one of the color settings you set the alpha to 100 and on the other you set the alpha to 0. Then you put that on the stage somewhere. Then you have your background image and you put that under your graphic (on a lower layer). Now you need to tell flash to use the graphic (square with the gradient) as the mask of the background. To do that, you would use a bit of code like this:


    Now, the square gradient mask will cover the background to the degree of the alpha setting. The higher the alpha the more of the background you see.


    Author Comment

    and if i had a small image say 16x16 or whatever, how would i tile it?  i dont think theres a background image option like there is on dreamweaver that lets you tile it in every direction right

    Author Comment

    one more thing...i tried that code and it doesn't work in AS3 it says
    LVL 8

    Accepted Solution

    Sorry about the code, I was thinking in terms of AS2. Also, 'background' is a reserved word in AS3, so change it to something else.

    The correct code for AS3 is:

    bg.mask = square_mask;

    And you are correct about the tiling. There is no function for that in AS3. It would have to be done manually with a function of something like that.


    Author Comment

    any advice on how to do that? i tried doing somethign with the addChild but the way i was doing it was making a new variable container for each tile and i figured that wouldn't be very effective

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
    It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
    The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now