/**
* Copyright a24 ( http://wonderfl.net/user/a24 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/5I6l
*/
// forked from hacker_9q56zfwm's forked from: 【研修0408】クラスの使い方例題3
// forked from hacker_9q56zfwm's 【研修0408】クラスの使い方例題3
package {
import flash.display.Sprite;
import caurina.transitions.Tweener;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
var star:StarDrawer = new StarDrawer();
addChild(star);
star.drawStar(10, 2, 0xFF0000);
Tweener.addTween(star, { thickness:50, color:0, lineLength:100, time:3 } );
}
}
}
import flash.display.Sprite;
class StarDrawer extends Sprite{
private var _lineLength:Number;
private var _thickness:Number;
private var _color:Number;
public function StarDrawer():void{
}
public function drawStar(lineLength:Number,thickness:Number,color:Number):void{
_lineLength=lineLength;
_thickness=thickness;
_color=color;
drawLine();
}
public function get lineLength():Number{ return _lineLength}
public function set lineLength(value:Number):void{
_lineLength= value;
drawLine();
}
public function get thickness ():Number{ return _thickness }
public function set thickness(value:Number):void{
_thickness = value;
drawLine();
}
public function get color():Number{ return _color }
public function set color(value:Number):void{
_color = value;
drawLine();
}
public function drawLine():void{
graphics.clear();
graphics.lineStyle(_thickness , _color);
graphics.moveTo(0 , _lineLength);
graphics.lineTo( _lineLength*4 , _lineLength);
graphics.lineTo( _lineLength, _lineLength*3);
graphics.lineTo( _lineLength*2 , 0);
graphics.lineTo( _lineLength*3 , _lineLength*3);
graphics.lineTo(0 , _lineLength);
}
}