Icon [Flash CS6]
////////////////////////////////////////////////////////////////////////////////
// Icon [Flash CS6]
//
// [AS3.0] beginGradientFill()メソッドだ!
// http://www.project-nya.jp/modules/weblog/details.php?blog_id=1062
//
// 文字表示部分
// matacat's Flash CS5 ICON [http://wonderfl.net/c/ysQp]
////////////////////////////////////////////////////////////////////////////////
/**
* Copyright ProjectNya ( http://wonderfl.net/user/ProjectNya )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/4WmoS
*/
////////////////////////////////////////////////////////////////////////////////
// Icon [Flash CS6]
//
// [AS3.0] beginGradientFill()メソッドだ!
// http://www.project-nya.jp/modules/weblog/details.php?blog_id=1062
//
// 文字表示部分
// matacat's Flash CS5 ICON [http://wonderfl.net/c/ysQp]
////////////////////////////////////////////////////////////////////////////////
package {
import flash.display.Sprite;
import flash.display.StageScaleMode;
import flash.display.StageAlign;
[SWF(backgroundColor="#FFFFFF", width="465", height="465", frameRate="30")]
public class Main extends Sprite {
private var icon:Icon;
public function Main() {
//Wonderfl.capture_delay(1);
init();
}
private function init():void {
icon = new Icon(160);
addChild(icon);
icon.x = 232;
icon.y = 232;
icon.scale = 2;
icon.init([0xFF5147, 0xFA3030]);
}
}
}
//////////////////////////////////////////////////
// Iconクラス [CS6]
//////////////////////////////////////////////////
import flash.display.Sprite;
import flash.display.Shape;
import flash.geom.Matrix;
import flash.display.GradientType;
import flash.display.SpreadMethod;
import flash.display.InterpolationMethod;
import flash.filters.DropShadowFilter;
class Icon extends Sprite {
private var size:uint;
private var colors:Array;
private var _scale:Number = 1;
private var fl:FlashCS6;
public function Icon(s:uint) {
size = s;
}
public function init(list:Array):void {
colors = list;
draw();
}
private function draw():void {
var base:Shape = new Shape();
addChild(base);
var alphas:Array = [1, 1];
var ratios:Array = [0, 255];
var matrix:Matrix = new Matrix();
matrix.createGradientBox(size*2, size*2, 0, -size*1.25, -size*1.25);
base.graphics.beginGradientFill(GradientType.RADIAL, colors, alphas, ratios, matrix, SpreadMethod.PAD, InterpolationMethod.RGB, 0);
base.graphics.drawRect(-size*0.5, -size*0.5, size, size);
base.graphics.drawRect(-size*0.44, -size*0.44, size*0.88, size*0.88);
base.graphics.endFill();
base.graphics.beginFill(0x360601, 0.8);
base.graphics.drawRect(-size*0.44, -size*0.44, size*0.88, size*0.88);
base.graphics.endFill();
var shade:DropShadowFilter = new DropShadowFilter(4, 90, 0x000000, 0.3, 8, 8, 2, 3, false, false);
base.filters = [shade];
//
fl = new FlashCS6(colors);
addChild(fl);
fl.x = - 84;
fl.y = - 82;
var shadow:DropShadowFilter = new DropShadowFilter(1, 45, 0xFF4444, 0.5, 2, 2, 2, 3, false, false);
fl.filters = [shadow];
}
public function get scale():Number {
return _scale;
}
public function set scale(param:Number):void {
_scale = param;
scaleX = scaleY = _scale;
}
}
//////////////////////////////////////////////////
// FlashCS6クラス
//////////////////////////////////////////////////
import flash.display.Sprite;
class FlashCS6 extends Sprite {
private var colors:Array;
private var FL_C:Vector.<int> = Vector.<int>([1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 3, 2, 3, 3]);
private var FL_D:Vector.<Number> = Vector.<Number>([48, 42, 94, 42, 95, 57, 64, 57, 64, 77, 92, 77, 92, 91, 64, 91, 64, 123, 48, 123, 104, 42, 120, 42, 120, 109, 120, 113, 125.5, 111.5, 125.5, 122, 121.5, 124, 117, 124, 104, 124, 104, 112]);
public function FlashCS6(list:Array) {
colors = list;
draw();
}
private function draw():void {
var alphas:Array = [1, 1];
var ratios:Array = [0, 255];
var matrix:Matrix = new Matrix();
matrix.createGradientBox(200, 200, 0, -60, -60);
graphics.beginGradientFill(GradientType.RADIAL, colors, alphas, ratios, matrix, SpreadMethod.PAD, InterpolationMethod.RGB, 0);
graphics.drawPath(FL_C, FL_D);
graphics.endFill();
}
}