Hello all,
I am having issue when setting alpha less than 1 as the pics below showing:
[URL=“http://forums.adobe.com/servlet/JiveServlet/downloadImage/25533/replayBtnAlpha0.6.png”]
the left pic is with alpha 1 and the right one is at 0.6 alpha.
package scripts
{
import flash.display.Shape;
import flash.display.Graphics;
public class Icons extends Shape
{
//replay
//const REPLAY_WIDTH:uint = 200;
const REPLAY_ICON_WIDTH_HEIGHT:uint = 40;
const REPLAY_RADIUS1:Number = 8/REPLAY_ICON_WIDTH_HEIGHT;
const REPLAY_RADIUS2:Number = 14/REPLAY_ICON_WIDTH_HEIGHT;
const REPLAY_RADIUS3:Number = 20/REPLAY_ICON_WIDTH_HEIGHT;
//right triangle - 90deg
const REPLAY_HYPOTENUSE:Number = 12/REPLAY_ICON_WIDTH_HEIGHT;
const REPLAY_ADJACENT:Number = 6/REPLAY_ICON_WIDTH_HEIGHT;
const REPLAY_ARROW_X1:Number = 3/REPLAY_ICON_WIDTH_HEIGHT;
const REPLAY_ARROW_Y1:Number = 20/REPLAY_ICON_WIDTH_HEIGHT;
const REPLAY_ARROW_X2:Number = 15/REPLAY_ICON_WIDTH_HEIGHT;
const REPLAY_ARROW_Y2:Number = 20/REPLAY_ICON_WIDTH_HEIGHT;
private var canvas:Shape;
private var eGraphics:Graphics;
public function Icons()
{
}
public function drawBtnReplay(bgColor, bgOpacity, iconColor, iconOpacity):Shape
{
canvas = new Shape();
eGraphics = canvas.graphics;
with(eGraphics)
{
lineStyle();
beginFill(bgColor, bgOpacity);
drawCircle(REPLAY_ICON_WIDTH_HEIGHT/2, REPLAY_ICON_WIDTH_HEIGHT/2, REPLAY_ICON_WIDTH_HEIGHT * REPLAY_RADIUS3);
endFill();
beginFill(iconColor, iconOpacity);
drawCircle(REPLAY_ICON_WIDTH_HEIGHT/2, REPLAY_ICON_WIDTH_HEIGHT/2, REPLAY_ICON_WIDTH_HEIGHT * REPLAY_RADIUS2)
endFill();
//*********************************** the triangle alpha issue /
beginFill(bgColor, bgOpacity);
moveTo(0, REPLAY_ICON_WIDTH_HEIGHT/2);
lineTo(REPLAY_ICON_WIDTH_HEIGHT/2, 0);
lineTo(REPLAY_ICON_WIDTH_HEIGHT/2, REPLAY_ICON_WIDTH_HEIGHT/2);
endFill()
//*********************** ********************************************************/
beginFill(bgColor, bgOpacity);
drawCircle(REPLAY_ICON_WIDTH_HEIGHT/2, REPLAY_ICON_WIDTH_HEIGHT/2, REPLAY_ICON_WIDTH_HEIGHT * REPLAY_RADIUS1)
endFill();
var opposite = Math.sqrt(((REPLAY_ICON_WIDTH_HEIGHT * REPLAY_HYPOTENUSE) * (REPLAY_ICON_WIDTH_HEIGHT * REPLAY_HYPOTENUSE)) - ((REPLAY_ICON_WIDTH_HEIGHT * REPLAY_ADJACENT) * (REPLAY_ICON_WIDTH_HEIGHT * REPLAY_ADJACENT)));//trace(opposite);
var oppositeX = (REPLAY_ICON_WIDTH_HEIGHT * REPLAY_ARROW_X1) + (REPLAY_ICON_WIDTH_HEIGHT * REPLAY_ADJACENT);//trace(oppositeX);
var oppositeY = (REPLAY_ICON_WIDTH_HEIGHT * REPLAY_ARROW_Y1) - opposite;//trace(oppositeY);
beginFill(iconColor, iconOpacity);
moveTo(REPLAY_ICON_WIDTH_HEIGHT * REPLAY_ARROW_X1, REPLAY_ICON_WIDTH_HEIGHT * REPLAY_ARROW_Y1);
lineTo(REPLAY_ICON_WIDTH_HEIGHT * REPLAY_ARROW_X2, REPLAY_ICON_WIDTH_HEIGHT * REPLAY_ARROW_Y2);
lineTo(oppositeX, oppositeY);
endFill();
}
canvas.rotation = -45;
return canvas;
}
}
the canvas(shape) returned is added to a Sprite and then setting its alpha to 0.6.
the sprite is acting as button with its upstate at 0.6 alpha(right pic) and downstate at 0.6 alpha(left pic), and the yellow triangle is to hide 1/4 of the black ring underneath. the button is supposed to look like the left pic.
Any help is very much appreciated.
Niusaul