Хорошо, я знаю, что это звучит практически элементарно, но я не понимаю, что я делаю здесь неправильно.
Я рисую простой округленный Rect
backing1.graphics.beginFill(bgColor);
backing1.graphics.lineStyle(borderSize, borderColor1);
backing1.graphics.drawRoundRect(position1, position1, sizeW-1, sizeH-1, cornerRadius1);
backing1.graphics.endFill();
//backing1.alpha = .1; //<-- tried setting alpha here didn't work
Потом попытался добавить его в мувиклип
bgHolder = new MovieClip;
bgHolder.alpha = 0.1;
bgHolder.addChild(backing1);
addChild(bgHolder);
Тем не менее цвет, который я использую, отображается на 100% :(
Полный код класса фона
package display{
import flash.display.DisplayObject;
import flash.display.LineScaleMode;
import flash.display.JointStyle;
import flash.display.MovieClip;
import flash.display.Graphics;
import flash.display.Sprite;
import flash.display.Shape;
import flash.events.Event;
import flash.utils.Timer;
import flash.text.TextField;
import flash.events.TimerEvent;
import model.*;
public class Background extends Sprite {
private const position1:Number=0;
private const position2:Number=1;
public static var instance:Background;
private var vTitle :TextField = new TextField();
private var tStorm :TextField = new TextField();
private var backing1 :Shape = new Shape();
private var backing2 :Shape = new Shape();
private var bgColor:uint=0xE8E7E7;
private var borderColor1:uint=0xCCCCCC;
private var borderColor2:uint=0xFFFFFF;
private var borderSize:uint=1;
private var cornerRadius1:uint=3;
private var cornerRadius2:uint=1;
private var sizeW:uint;
private var sizeH:uint;
private var bgHolder:MovieClip;
public var titleString:String="";
public function Background():void {
if (stage) {
init();
} else {
addEventListener(Event.ADDED_TO_STAGE, init);
}
instance=this;
}
private function init(e:Event = null):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
bgHolder=new MovieClip ;
bgHolder.alpha=0.1;
bgHolder.addChild(backing1);
addChild(bgHolder);
addChild(backing2);
addChild(vTitle);
addChild(tStorm);
}
public function drawBackground(w, h, mainTitle, color, otherText):void {
sizeW=w;
sizeH=h;
bgColor=color;
titleString=mainTitle;
vTitle.defaultTextFormat=Fonts.PlayingTitle;
vTitle.border=false;
vTitle.embedFonts=false;
vTitle.gridFitType="SUBPIXEL";
vTitle.sharpness=100;
vTitle.antiAliasType=flash.text.AntiAliasType.ADVANCED;
vTitle.selectable=false;
vTitle.mouseEnabled=false;
vTitle.x=5;// 8-3=5 to align copy to video player
vTitle.y=8;
vTitle.width=sizeW-16;
vTitle.height=30;
vTitle.text=titleString;
tStorm.defaultTextFormat=Fonts.TouchStormR;
tStorm.border=false;
tStorm.embedFonts=false;
tStorm.gridFitType="SUBPIXEL";
tStorm.sharpness=100;
tStorm.antiAliasType=flash.text.AntiAliasType.ADVANCED;
tStorm.selectable=false;
tStorm.mouseEnabled=false;
tStorm.x=8;
tStorm.y=sizeH-20;
tStorm.width=sizeW-16;
tStorm.height=20;
tStorm.text=otherText;
backing1.graphics.beginFill(bgColor, 0.1);
//backing1.graphics.beginFill(bgColor);
backing1.graphics.lineStyle(borderSize, borderColor1);
backing1.graphics.drawRoundRect(position1, position1, sizeW-1, sizeH-1, cornerRadius1);
backing1.graphics.endFill();
backing1.alpha=0.5;
backing2.graphics.beginFill(bgColor);
backing2.graphics.lineStyle(borderSize, borderColor2);
backing2.graphics.drawRoundRect(position2, position2, sizeW-3, sizeH-3, cornerRadius2);
backing2.graphics.endFill();
}
public function switchTitle(sentText):void {
titleString=sentText;
vTitle.text=titleString;
}
}
}