[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 493
  • Last Modified:

tiled background + gradient in flash

How would i go about doing something like this using actionscript 3? I tried google but couldn't get anything satisfactory...as for the gradient overlay i'm guessing just a transparent png or something like that which goes over the background?

http://s3.envato.com/files/41768/index.html
0
Abyssmal
Asked:
Abyssmal
  • 3
  • 2
1 Solution
 
section25Commented:
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:

background.cacheAsBitmap=true;
square_mask.cacheAsBitmap=true;
background.setMask(square_mask);

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.



0
 
AbyssmalAuthor Commented:
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
0
 
AbyssmalAuthor Commented:
one more thing...i tried that code and it doesn't work in AS3 it says
0
 
section25Commented:
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.cacheAsBitmap=true;
square_mask.cacheAsBitmap=true;
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.


0
 
AbyssmalAuthor Commented:
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
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now