Groups | Blog | Home
all groups > flash actionscript > june 2004 >

flash actionscript : dynamic background fill


J formerly private news
6/30/2004 1:23:07 PM
Hi all,

I have a background gradient fill that seems to misbehave and appear in the
foreground?
im using flash mx so i suppose im asking how can I get this to appear as a
background not in the foreground and could it be done better in mx?

_root.createEmptyMovieClip("bkgrnd_mc", 1);
// make a gradient with 6 colors
colors = [0x6BEDF3, 0x59DCF1, 0x45C9ED, 0x3BBFEB, 0x2FB4E8, 0x0991E1];
// all of the colors should be opaque
alphas = [100, 95, 90, 85, 80, 75];
//alphas = [75, 80, 85, 90, 95, 100];
// these ratios are in hexadeciaml, in even steps from 0 to 255
ratios = [0x0, 0x33, 0x66, 0x99, 0xCC, 0xFF];
// 0 radians is the equivalent of no rotation for the gradient
Radians = (degrees/180)*Math.PI;
// build our matrix using the "box" method
matrix = {matrixType:"box", x:0, y:0, w:400, h:600, r:(90/180)*Math.PI};
// put all that together in the beginGradientFill
bkgrnd_mc.beginGradientFill("linear", colors, alphas, ratios, matrix);
// draw the bounding box
bkgrnd_mc.moveTo(0, 0);
bkgrnd_mc.lineTo(800, 0);
bkgrnd_mc.lineTo(800, 600);
bkgrnd_mc.lineTo(0, 600);
bkgrnd_mc.lineTo(0, 0);
// close up the fill
bkgrnd_mc.endFill();

Jack
6/30/2004 9:11:41 PM
you can swap the stacking order,

createEmptyMovieClip("bkgrnd_mc",1);
square.swapDepths(bkgrnd_mc);
square.onPress=function(){bkgrnd_mc.unloadMovie(); };

this link explains it well,
http://www.kirupa.com/developer/actionscript/depths2.htm

Laiverd.COM
6/30/2004 9:47:14 PM
If instead of using

_root.createEmptyMovieClip("bkgrnd_mc", 1);

you'd manually put an empty movieclip on stage (say "container_mc") then you
can put container_mc on any layer you want, also on the lowest. Then Use:

container_mc.createEmptyMovieClip("bkgrnd_mc", 1);

This is the only solution as dynamically created clips will by default
appear on top of everything created manually.

John


--
----------------------------------------------------------------------------
-----------
RESOURCES
http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash
----------------------------------------------------------------------------
-----------
TUTORIALS at
www.laiverd.com
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------

J formerly private news
7/1/2004 9:50:33 AM
thanks guys mucho appreciated (will slim down the site even more :P)



[quoted text, click to view]

AddThis Social Bookmark Button