1 | package {
|
---|
2 |
|
---|
3 | import flash.display.Sprite;
|
---|
4 |
|
---|
5 | class InnerBackground extends Sprite {
|
---|
6 | private var colour:Number=0;
|
---|
7 | private var colour_2:Number=-1;
|
---|
8 | private var angle:Number = 90;
|
---|
9 |
|
---|
10 | function InnerBackground( lv:Array )
|
---|
11 | {
|
---|
12 | if( lv.inner_background == undefined )
|
---|
13 | return;
|
---|
14 |
|
---|
15 | var vals:Array = lv.inner_background.split(",");
|
---|
16 |
|
---|
17 | this.colour = _root.get_colour( vals[0] );
|
---|
18 |
|
---|
19 | trace( this.colour)
|
---|
20 |
|
---|
21 | if( vals.length > 1 )
|
---|
22 | this.colour_2 = _root.get_colour( vals[1] );
|
---|
23 |
|
---|
24 | if( vals.length > 2 )
|
---|
25 | this.angle = Number( vals[2] );
|
---|
26 |
|
---|
27 | this.mc = _root.createEmptyMovieClip( "inner_background", _root.getNextHighestDepth() );
|
---|
28 |
|
---|
29 | // create shadow filter
|
---|
30 | var dropShadow = new flash.filters.DropShadowFilter();
|
---|
31 | dropShadow.blurX = 5;
|
---|
32 | dropShadow.blurY = 5;
|
---|
33 | dropShadow.distance = 5;
|
---|
34 | dropShadow.angle = 45;
|
---|
35 | dropShadow.quality = 2;
|
---|
36 | dropShadow.alpha = 0.5;
|
---|
37 | // apply shadow filter
|
---|
38 |
|
---|
39 | // disabled for now...
|
---|
40 | //this.mc.filters = [dropShadow];
|
---|
41 |
|
---|
42 | }
|
---|
43 |
|
---|
44 | function move( box:Box )
|
---|
45 | {
|
---|
46 | if( this.mc == undefined )
|
---|
47 | return;
|
---|
48 |
|
---|
49 | this.mc.clear();
|
---|
50 | this.mc.lineStyle(1, 0xFFFFFF, 0);
|
---|
51 |
|
---|
52 | if( this.colour_2 > -1 )
|
---|
53 | {
|
---|
54 | // Gradients: http://www.lukamaras.com/tutorials/actionscript/gradient-colored-movie-background-actionscript.html
|
---|
55 | var fillType:String = "linear";
|
---|
56 | var colors:Array = [this.colour, this.colour_2];
|
---|
57 | var alphas:Array = [100, 100];
|
---|
58 | var ratios:Array = [0, 255];
|
---|
59 | var matrix = {matrixType:"box", x:0, y:0, w:box.width, h:box.height, r:this.angle/180*Math.PI};
|
---|
60 | this.mc.beginGradientFill(fillType, colors, alphas, ratios, matrix);
|
---|
61 | }
|
---|
62 | else
|
---|
63 | this.mc.beginFill( this.colour, 100);
|
---|
64 |
|
---|
65 |
|
---|
66 | this.mc.moveTo(0, 0);
|
---|
67 | this.mc.lineTo(box.width, 0);
|
---|
68 | this.mc.lineTo(box.width, box.height);
|
---|
69 | this.mc.lineTo(0, box.height);
|
---|
70 | this.mc.lineTo(0, 0);
|
---|
71 | this.mc.endFill();
|
---|
72 |
|
---|
73 | this.mc._x = box.left;
|
---|
74 | this.mc._y = box.top;
|
---|
75 | }
|
---|
76 |
|
---|
77 | }
|
---|