Forked from: paq's your icon diff:93 Your Icon Generator on wonderfl clockmaker forked:0favorite:7lines:80license : MIT License modified : 2010-05-10 23:09:26 Embed Tweet <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" addedToStage="_init(event)" width="465" height="465"> <s:layout> <s:VerticalLayout horizontalAlign="center" paddingTop="20" gap="10"/> </s:layout> <fx:Script> <![CDATA[ import flash.display.*; import flash.filters.*; import flash.net.*; import frocessing.color.ColorHSV; private static const SIZE_LIST:Object = { front: [{ x: 12, y: 12 }, { x: 243, y: 12 }, { x: 243, y: 231 }, { x: 12, y: 231 }], side: [{ x: 0, y: 0 }, { x: 12, y: 12 }, { x: 12, y: 230 }, { x: 0, y: 218 }], back: [{ x: 0, y: 0 }, { x: 230, y: 0 }, { x: 230, y: 12 }, { x: 12, y: 12 }] }; private var _icon:Sprite; private function _init(e:Event):void { canvas.addChild(_icon = new Sprite); _icon.filters = [ new DropShadowFilter(4, 90, 0x0, 1, 8, 8, 0.53)]; _draw(); // wonderfl icon var icon:String = this.root.loaderInfo.parameters[ "viewer.iconURL" ]; if (icon) { var l:Loader = new Loader; l.contentLoaderInfo.addEventListener(Event.COMPLETE, function():void { l.x = 77; l.y = 70; l.width = l.height = 100; l.filters = [ new BevelFilter(1, 270, 0xFFFFFF, 1, 0x0, 1, 0, 0, 1, 1)]; }); l.load(new URLRequest(icon)); _icon.addChild(l); } } private function _draw():void { // color var hsvFront:ColorHSV = new ColorHSV(); hsvFront.value = colorBg.selectedColor; var hsvSide:ColorHSV = hsvFront.clone(); // front var colorBg1:uint = hsvFront.value; hsvFront.value = colorBg1; hsvFront.v -= 0.30; var colorBg2:uint = hsvFront.value; // side hsvSide.v -= 0.10; var sideColor1:uint = hsvSide.value; hsvSide.v -= 0.25; var sideColor2:uint = hsvSide.value; // text var colorText1:uint = colorText.selectedColor; hsvFront.value = colorText1; hsvFront.v -= 0.15; var colorText2:uint = hsvFront.value; // fill _fill(_icon.graphics, SIZE_LIST.front, 90, colorBg1, colorBg2); _fill(_icon.graphics, SIZE_LIST.side, 90, sideColor1, sideColor2); _fill(_icon.graphics, SIZE_LIST.back, 0, colorText1, colorText2); } private function _fill(target:Graphics, arr:Array, rot:int, color1:uint, color2:uint):void { var matr:Matrix = new Matrix(); matr.createGradientBox(arr[ 2 ].x - arr[ 0 ].x, arr[ 2 ].y - arr[ 0 ].y, rot * Math.PI / 180, 0, 0); target.beginGradientFill(GradientType.LINEAR, [ color1, color2 ], [ 1, 1 ], [ 0x00, 0xFF ], matr, SpreadMethod.PAD); target.moveTo(arr[ 0 ].x, arr[ 0 ].y); target.lineTo(arr[ 1 ].x, arr[ 1 ].y); target.lineTo(arr[ 2 ].x, arr[ 2 ].y); target.lineTo(arr[ 3 ].x, arr[ 3 ].y); } private function _onBtnClick(event:MouseEvent):void { navigateToURL(new URLRequest("http://icon-generator.net/"), "_blank"); } ]]> </fx:Script> <s:Label text="Your Icon Generator on wonderfl" fontSize="20" fontWeight="bold"/> <mx:Form> <mx:FormItem label="Main Color"> <mx:ColorPicker id="colorBg" selectedColor="0xE04749" change="_draw()"/> </mx:FormItem> <mx:FormItem label="Sub Color"> <mx:ColorPicker id="colorText" selectedColor="0xFFAE61" change="_draw()"/> </mx:FormItem> </mx:Form> <mx:UIComponent id="canvas" width="256" height="256"/> <s:Button label="Try Icon Generator Pro" click="_onBtnClick(event)" height="40" /> </s:Application> Code Fullscreen Preview Fullscreen OKASUKE more_more_fo.. shevchenko novita001 Nyarineko narutohyper : 続きはIconGeneratorで! paq : 宣伝!w CMMC generator mxml spark label height width text