STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
229593
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2595 · P5190

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/71892241?noj=FRM71892241-21DC" width="1" height="1"></div>

seed.swf

This is the info page for
Flash #2234

(Click the ID number above for more basic data on this flash file.)


Text
Welcome to Seed.

I'm sorry but something went wrong. :(

ActionScript [AS3]

Section 1
//Color (fl.motion.Color) package fl.motion { import flash.display.*; import flash.geom.*; public class Color extends ColorTransform { private var _tintMultiplier:Number;// = 0 private var _tintColor:Number;// = 0 public function Color(_arg1:Number=1, _arg2:Number=1, _arg3:Number=1, _arg4:Number=1, _arg5:Number=0, _arg6:Number=0, _arg7:Number=0, _arg8:Number=0){ _tintColor = 0; _tintMultiplier = 0; super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8); } public function setTint(_arg1:uint, _arg2:Number):void{ var _local3:uint; var _local4:uint; var _local5:uint; this._tintColor = _arg1; this._tintMultiplier = _arg2; this.redMultiplier = (this.greenMultiplier = (this.blueMultiplier = (1 - _arg2))); _local3 = ((_arg1 >> 16) & 0xFF); _local4 = ((_arg1 >> 8) & 0xFF); _local5 = (_arg1 & 0xFF); this.redOffset = Math.round((_local3 * _arg2)); this.greenOffset = Math.round((_local4 * _arg2)); this.blueOffset = Math.round((_local5 * _arg2)); } public function set tintColor(_arg1:uint):void{ this.setTint(_arg1, this.tintMultiplier); } public function get brightness():Number{ return ((this.redOffset) ? (1 - this.redMultiplier) : (this.redMultiplier - 1)); } private function deriveTintColor():uint{ var _local1:Number; var _local2:uint; var _local3:uint; var _local4:uint; var _local5:uint; _local1 = (1 / this.tintMultiplier); _local2 = Math.round((this.redOffset * _local1)); _local3 = Math.round((this.greenOffset * _local1)); _local4 = Math.round((this.blueOffset * _local1)); _local5 = (((_local2 << 16) | (_local3 << 8)) | _local4); return (_local5); } public function get tintMultiplier():Number{ return (this._tintMultiplier); } public function get tintColor():uint{ return (this._tintColor); } public function set brightness(_arg1:Number):void{ var _local2:Number; var _local3:Number; if (_arg1 > 1){ _arg1 = 1; } else { if (_arg1 < -1){ _arg1 = -1; }; }; _local2 = (1 - Math.abs(_arg1)); _local3 = 0; if (_arg1 > 0){ _local3 = (_arg1 * 0xFF); }; this.redMultiplier = (this.greenMultiplier = (this.blueMultiplier = _local2)); this.redOffset = (this.greenOffset = (this.blueOffset = _local3)); } public function set tintMultiplier(_arg1:Number):void{ this.setTint(this.tintColor, _arg1); } private function parseXML(_arg1:XML=null):Color{ var _local2:XML; var _local3:XML; var _local4:String; var _local5:uint; if (!_arg1){ return (this); }; _local2 = _arg1.elements()[0]; if (!_local2){ return (this); }; for each (_local3 in _local2.attributes()) { _local4 = _local3.localName(); if (_local4 == "tintColor"){ _local5 = (Number(_local3.toString()) as uint); this.tintColor = _local5; } else { this[_local4] = Number(_local3.toString()); }; }; return (this); } public static function interpolateColor(_arg1:uint, _arg2:uint, _arg3:Number):uint{ var _local4:Number; var _local5:uint; var _local6:uint; var _local7:uint; var _local8:uint; var _local9:uint; var _local10:uint; var _local11:uint; var _local12:uint; var _local13:uint; var _local14:uint; var _local15:uint; var _local16:uint; var _local17:uint; _local4 = (1 - _arg3); _local5 = ((_arg1 >> 24) & 0xFF); _local6 = ((_arg1 >> 16) & 0xFF); _local7 = ((_arg1 >> 8) & 0xFF); _local8 = (_arg1 & 0xFF); _local9 = ((_arg2 >> 24) & 0xFF); _local10 = ((_arg2 >> 16) & 0xFF); _local11 = ((_arg2 >> 8) & 0xFF); _local12 = (_arg2 & 0xFF); _local13 = ((_local5 * _local4) + (_local9 * _arg3)); _local14 = ((_local6 * _local4) + (_local10 * _arg3)); _local15 = ((_local7 * _local4) + (_local11 * _arg3)); _local16 = ((_local8 * _local4) + (_local12 * _arg3)); _local17 = ((((_local13 << 24) | (_local14 << 16)) | (_local15 << 8)) | _local16); return (_local17); } public static function interpolateTransform(_arg1:ColorTransform, _arg2:ColorTransform, _arg3:Number):ColorTransform{ var _local4:Number; var _local5:ColorTransform; _local4 = (1 - _arg3); _local5 = new ColorTransform(((_arg1.redMultiplier * _local4) + (_arg2.redMultiplier * _arg3)), ((_arg1.greenMultiplier * _local4) + (_arg2.greenMultiplier * _arg3)), ((_arg1.blueMultiplier * _local4) + (_arg2.blueMultiplier * _arg3)), ((_arg1.alphaMultiplier * _local4) + (_arg2.alphaMultiplier * _arg3)), ((_arg1.redOffset * _local4) + (_arg2.redOffset * _arg3)), ((_arg1.greenOffset * _local4) + (_arg2.greenOffset * _arg3)), ((_arg1.blueOffset * _local4) + (_arg2.blueOffset * _arg3)), ((_arg1.alphaOffset * _local4) + (_arg2.alphaOffset * _arg3))); return (_local5); } public static function fromXML(_arg1:XML):Color{ return (Color(new (Color).parseXML(_arg1))); } } }//package fl.motion
Section 2
//Blueprint (Blueprint) package { public class Blueprint { protected var specie:String; protected var props:Object; public function Blueprint(){ var _local1:*; var _local2:Array; super(); this.specie = "unknown"; props = {}; _local1 = new Props(); for each (_local2 in _local1) { if (_local2[3] == "num"){ props[_local2[0]] = new RangedNumber(_local2[1], _local2[2], 0); props[_local2[0]].randomize(); } else { if (_local2[3] == "col"){ props[_local2[0]] = new RangedColor(0); props[_local2[0]].randomize(); } else { if (_local2[3] == "int"){ props[_local2[0]] = new RangedInt(_local2[1], _local2[2], 0); props[_local2[0]].randomize(); }; }; }; }; } public function branchRotation(_arg1:int=1){ var _local2:*; var _local3:*; _local2 = (_arg1 / maxLevel()); _local3 = ((_local2 * props.maxTopRotation) + ((1 - _local2) * props.maxRootRotation)); return ((-(_local3) + ((Math.random() * 2) * _local3))); } public function mutate(_arg1=0.4){ var _local2:Array; var _local3:*; _local2 = new Array(); for each (_local3 in props) { _local2.push(_local3); }; _local2[Math.floor((_local2.length * Math.random()))].mutate(_arg1); } public function trunkLen(){ return (props.trunkLen); } public function petal(_arg1:int=0):Object{ var _local2:*; var _local3:*; var _local4:*; var _local5:*; var _local6:*; var _local7:*; var _local8:*; var _local9:*; _local2 = {}; _local3 = props.petalHueDev; _local4 = props.petalSatDev; _local5 = props.petalValDev; _local6 = props.petalLineHue; _local7 = props.petalLineSat; _local8 = props.petalLineVal; _local2.color = Colors.randomize(petalColor(_arg1), _local3, _local4, _local5); _local2.r = ringRadius(_arg1, false); _local2.ext = petalLength(_arg1); _local9 = (_local2.ext * props.petalLengthDev); _local2.ext = ((_local2.ext - _local9) + ((_local9 * 2) * Math.random())); _local2.roundness = petalRoundness(_arg1); _local2.lineSize = props.petalLineSize; _local2.lineColor = Colors.modify(_local2.color, _local6, _local7, _local8); return (_local2); } public function tipRadius(){ return (props.tipRadius); } public function petalLength(_arg1:int=0):Number{ var _local2:Number; _local2 = (_arg1 / (numRings() - 1)); return (((props.coreLength * (1 - _local2)) + (props.rimLength * _local2))); } public function numFlowers():uint{ return (props.numFlowers); } public function numPetals(_arg1:int=0):int{ var _local2:Number; _local2 = (_arg1 / (numRings() - 1)); return (Math.round(((props.corePetals * (1 - _local2)) + (props.rimPetals * _local2)))); } public function maxLevel():uint{ if (Math.pow(2, props.maxLevel) < props.numFlowers){ return (Math.ceil((Math.log(props.numFlowers) / Math.log(2)))); }; return (props.maxLevel); } public function flowerGrowSpeed(){ return (props.flowerGrowSpeed); } public function numRings():int{ return (Math.max(props.numRings, 2)); } public function branchColor(){ return (props.branchColor); } public function ringRadius(_arg1:int=0, _arg2:Boolean=false):Number{ if (_arg1 < 0){ throw (new Error("Blueprint/ringRadius: Negative Ring")); }; if ((((_arg1 == 0)) && (!(_arg2)))){ return (petalLength(_arg1)); }; if (_arg2){ return ((ringRadius(_arg1, false) + petalLength(_arg1))); }; return (ringRadius((_arg1 - 1), true)); } public function clone():Blueprint{ var _local1:Blueprint; var _local2:*; var _local3:Array; _local1 = new Blueprint(); _local2 = new Props(); for each (_local3 in _local2) { if (_local3[3] == "num"){ _local1.props[_local3[0]] = new RangedNumber(_local3[1], _local3[2], this.props[_local3[0]]); } else { if (_local3[3] == "col"){ _local1.props[_local3[0]] = new RangedColor(this.props[_local3[0]]); } else { if (_local3[3] == "int"){ _local1.props[_local3[0]] = new RangedInt(_local3[1], _local3[2], this.props[_local3[0]]); }; }; }; }; return (_local1); } public function branchLength(_arg1:int=1){ return (((props.avgBranchLength / 2) + (Math.random() * props.avgBranchLength))); } public function coreScale(){ return (props.coreScale); } public function toString():String{ var _local1:Array; var _local2:*; var _local3:Array; _local1 = new Array(); _local2 = new Props(); for each (_local3 in _local2) { if (_local3[3] == "col"){ _local1.push(("0x" + props[_local3[0]].valueOf().toString(16))); } else { if (_local3[3] == "num"){ _local1.push(props[_local3[0]].valueOf().toFixed(1)); } else { _local1.push(props[_local3[0]].valueOf()); }; }; }; return (_local1.toString()); } public function apical(){ return (props.apical); } public function radiusMtp(){ return (props.radiusMtp); } public function petalColor(_arg1:int=0):uint{ var _local2:Number; _local2 = (_arg1 / (numRings() - 1)); return (Colors.interpolate(props.coreColor, props.rimColor, _local2)); } public function petalRoundness(_arg1:int=0){ var _local2:Number; _local2 = (_arg1 / (numRings() - 1)); return (((props.coreRoundness * (1 - _local2)) + (props.rimRoundness * _local2))); } public function combine(_arg1:Blueprint):Blueprint{ var _local2:*; var _local3:*; var _local4:Array; _local2 = clone(); _local3 = new Props(); for each (_local4 in _local3) { _local2.props[_local4[0]] = _arg1.props[_local4[0]].combine(props[_local4[0]]); }; return (_local2); } public static function fromString(_arg1:String):Blueprint{ var _local2:Blueprint; var _local3:*; var _local4:Array; var _local5:int; var _local6:Array; _local2 = new (Blueprint); _local3 = new Props(); _local4 = _arg1.split(","); _local5 = 0; if (_local4.length != _local3.length){ return (Species.getSpecies(Species.BFOD)); }; for each (_local6 in _local3) { if (isNaN(Number(_local4[_local5]))){ return (Species.getSpecies(Species.BFOD)); }; if (_local6[3] == "num"){ _local2.props[_local6[0]] = new RangedNumber(_local6[1], _local6[2], _local4[_local5]); } else { if (_local6[3] == "col"){ _local2.props[_local6[0]] = new RangedColor(_local4[_local5]); } else { if (_local6[3] == "int"){ _local2.props[_local6[0]] = new RangedInt(_local6[1], _local6[2], _local4[_local5]); }; }; }; _local5++; }; return (_local2); } } }//package
Section 3
//BlueprintReader (BlueprintReader) package { import flash.text.*; import flash.display.*; import flash.events.*; public class BlueprintReader extends Sprite { private var dragBox:Sprite; private var buttonTargetY:int; private var buttonTargetX:int; private var showButton:Sprite; private var world:World; private var hidden:Boolean; private var curDNA:String; private var windowTargetX:int; private var window:Sprite; private var field:TextField; public static const BAR_WIDTH:int = 700; public static const MOVE_SPEED:Number = 0.3; public static const READER_WIDTH:int = 108; public function BlueprintReader(_arg1:World){ this.world = _arg1; hidden = true; curDNA = "No DNA entered"; this.addEventListener(Event.ADDED_TO_STAGE, added_handler); } private function added_handler(_arg1:Event){ drawWindow(); drawShowButton(); drawDragBox(); hideWindow(); } private function drawDragBox(){ var _local1:*; dragBox = new Sprite(); dragBox.y = 24; GraphicElements.drawBox(dragBox, 102, 44); addChild(dragBox); _local1 = new TextField(); _local1.defaultTextFormat = GraphicElements.getMainTextFormat(12, 0xCCCCCC); _local1.text = "drag plant here"; _local1.x = 8; _local1.y = 10; dragBox.addChild(_local1); } private function drawShowButton(){ showButton = new Sprite(); GraphicElements.makeButton(showButton, 102, "show DNA"); addChild(showButton); showButton.addEventListener(MouseEvent.MOUSE_OVER, mouseOver_handler); showButton.addEventListener(MouseEvent.CLICK, showButtonClick_handler); } private function mouseOver_handler(_arg1:MouseEvent){ _arg1.currentTarget.filters = GraphicElements.getMouseOverFilters(); _arg1.currentTarget.addEventListener(MouseEvent.MOUSE_OUT, mouseOut_handler); } private function showButtonClick_handler(_arg1:MouseEvent){ if (hidden){ showWindow(); } else { hideWindow(); }; } private function seedButtonClick_handler(_arg1:MouseEvent){ curDNA = field.text; world.addAnywhere(Blueprint.fromString(curDNA)); } private function drawWindow(){ var _local1:*; window = new Sprite(); GraphicElements.makeButton(window, BAR_WIDTH, "DNA"); addChild(window); field = new TextField(); field.defaultTextFormat = GraphicElements.getMainTextFormat(11, 12040191); field.type = TextFieldType.INPUT; field.restrict = "\\- ,.0-9a-fA-FxX"; field.width = BAR_WIDTH; field.height = (1.5 * field.textHeight); field.text = curDNA; field.x = 30; field.y = 2; window.x = READER_WIDTH; window.addChild(field); _local1 = new Sprite(); GraphicElements.makeButton(_local1, 102, "seed this"); _local1.x = (BAR_WIDTH - 208); _local1.y = 24; window.addChild(_local1); _local1.addEventListener(MouseEvent.MOUSE_OVER, mouseOver_handler, false, 0, true); _local1.addEventListener(MouseEvent.CLICK, seedButtonClick_handler, false, 0, true); } public function setBlueprint(_arg1:Blueprint){ curDNA = _arg1.toString().replace(/,/g, ", "); if (!hidden){ field.text = curDNA; }; } public function showWindow(){ hidden = false; if (window == null){ drawWindow(); }; TextField(showButton.getChildAt(0)).text = "hide DNA"; windowTargetX = ((-(BAR_WIDTH) + READER_WIDTH) - 6); buttonTargetX = -106; buttonTargetY = 48; addEventListener(Event.ENTER_FRAME, enterFrame_handler); } private function mouseOut_handler(_arg1:MouseEvent){ _arg1.currentTarget.filters = null; } private function enterFrame_handler(_arg1:Event){ window.x = ((windowTargetX * MOVE_SPEED) + (window.x * (1 - MOVE_SPEED))); showButton.x = ((buttonTargetX * MOVE_SPEED) + (showButton.x * (1 - MOVE_SPEED))); showButton.y = ((buttonTargetY * MOVE_SPEED) + (showButton.y * (1 - MOVE_SPEED))); if (((((window.x - windowTargetX) > -1)) && (((window.x - windowTargetX) < 1)))){ window.x = windowTargetX; showButton.x = buttonTargetX; showButton.y = buttonTargetY; removeEventListener(Event.ENTER_FRAME, enterFrame_handler); if (hidden){ removeWindow(); }; }; } private function removeWindow(){ removeChild(window); window = null; field = null; } private function hideWindow(){ hidden = true; windowTargetX = READER_WIDTH; buttonTargetX = 0; buttonTargetY = 0; curDNA = field.text; addEventListener(Event.ENTER_FRAME, enterFrame_handler); TextField(showButton.getChildAt(0)).text = "show DNA"; } } }//package
Section 4
//Colors (Colors) package { import fl.motion.*; public class Colors { public static function randomize(_arg1:uint, _arg2:Number, _arg3:Number, _arg4:Number):uint{ var _local5:*; var _local6:*; var _local7:*; if (_arg2 >= 1){ _local7 = Math.random(); } else { _local7 = (-(_arg2) + ((Math.random() * 2) * _arg2)); }; _local5 = ((-0.97 * _arg3) + ((Math.random() * 2) * _arg3)); _local6 = ((-0.97 * _arg4) + ((Math.random() * 2) * _arg4)); return (modify(_arg1, _local7, _local5, _local6)); } public static function rgb2hex(_arg1, _arg2, _arg3){ return ((((_arg1 << 16) | (_arg2 << 8)) | _arg3)); } public static function rgb2hsv(_arg1, _arg2, _arg3){ var _local4:*; var _local5:*; var _local6:*; var _local7:*; var _local8:*; var _local9:*; _arg1 = (_arg1 / 0xFF); _arg2 = (_arg2 / 0xFF); _arg3 = (_arg3 / 0xFF); _local4 = Math.min(Math.min(_arg1, _arg2), _arg3); _local9 = Math.max(Math.max(_arg1, _arg2), _arg3); if (_local4 == _local9){ return ({h:Math.floor((Math.random() * 360)), s:1, v:(_local9 * 100)}); }; _local5 = ((_arg1)==_local4) ? (_arg2 - _arg3) : ((_arg2)==_local4) ? (_arg3 - _arg1) : (_arg1 - _arg2); _local6 = ((_arg1)==_local4) ? 3 : ((_arg2)==_local4) ? 5 : 1; _local7 = (Math.floor(((_local6 - (_local5 / (_local9 - _local4))) * 60)) % 360); _local8 = Math.floor((((_local9 - _local4) / _local9) * 100)); _local9 = Math.floor((_local9 * 100)); return ({h:_local7, s:_local8, v:_local9}); } public static function interpolate(_arg1:uint, _arg2:uint, _arg3:Number):uint{ return (Color.interpolateColor(_arg1, _arg2, _arg3)); } public static function modify(_arg1:uint, _arg2:Number, _arg3:Number, _arg4:Number){ var _local5:*; var _local6:*; var _local7:*; var _local8:*; var _local9:*; _local5 = ((_arg1 >> 24) & 0xFF); _local6 = ((_arg1 >> 16) & 0xFF); _local7 = ((_arg1 >> 8) & 0xFF); _local8 = (_arg1 & 0xFF); _local9 = rgb2hsv(_local6, _local7, _local8); _local9.h = ((_arg2)>0) ? (_local9.h + (_arg2 * 360)) : (_local9.h + (360 - _arg2)); _local9.s = (_local9.s + (_arg3 * 100)); _local9.v = (_local9.v + (_arg4 * 100)); _local9.s = Math.max(Math.min(_local9.s, 100), 0); _local9.v = Math.max(Math.min(_local9.v, 100), 0); _local9 = hsv2rgb(_local9.h, _local9.s, _local9.v); return (rgb2hex(_local9.r, _local9.g, _local9.b)); } public static function hsv2rgb(_arg1, _arg2, _arg3){ var _local4:*; var _local5:*; var _local6:*; var _local7:*; var _local8:*; var _local9:*; var _local10:*; var _local11:*; _arg1 = (_arg1 % 360); if (_arg3 == 0){ return ({r:0, g:0, b:0}); }; _arg2 = (_arg2 / 100); _arg3 = (_arg3 / 100); _arg1 = (_arg1 / 60); _local7 = Math.floor(_arg1); _local8 = (_arg1 - _local7); _local9 = (_arg3 * (1 - _arg2)); _local10 = (_arg3 * (1 - (_arg2 * _local8))); _local11 = (_arg3 * (1 - (_arg2 * (1 - _local8)))); if (_local7 == 0){ _local4 = _arg3; _local5 = _local11; _local6 = _local9; } else { if (_local7 == 1){ _local4 = _local10; _local5 = _arg3; _local6 = _local9; } else { if (_local7 == 2){ _local4 = _local9; _local5 = _arg3; _local6 = _local11; } else { if (_local7 == 3){ _local4 = _local9; _local5 = _local10; _local6 = _arg3; } else { if (_local7 == 4){ _local4 = _local11; _local5 = _local9; _local6 = _arg3; } else { if (_local7 == 5){ _local4 = _arg3; _local5 = _local9; _local6 = _local10; }; }; }; }; }; }; _local4 = Math.floor((_local4 * 0xFF)); _local5 = Math.floor((_local5 * 0xFF)); _local6 = Math.floor((_local6 * 0xFF)); return ({r:_local4, g:_local5, b:_local6}); } } }//package
Section 5
//FertileEarth (FertileEarth) package { import flash.display.*; public dynamic class FertileEarth extends MovieClip { } }//package
Section 6
//Flower (Flower) package { import flash.display.*; import flash.geom.*; import flash.events.*; public class Flower extends Sprite { var size:Number; private var rings:Array; private var DNA:Blueprint; public static const GROW_SPEED = 1; public function Flower(_arg1){ this.DNA = _arg1; rings = new Array(); size = 0; if (DNA.coreScale() > 0.1){ constructCore(); }; constructRings(); addEventListener(Event.ADDED_TO_STAGE, added_handler); } private function added_handler(_arg1:Event){ var _local2:Shape; removeEventListener(Event.ADDED_TO_STAGE, added_handler); for each (_local2 in rings) { _local2 = rings.pop(); addChild(_local2); _local2.width = (_local2.height = 1); rings.unshift(_local2); }; } private function constructCore(){ rings.push(new Shape()); rings[0].graphics.lineStyle(DNA.petal(0).lineSize, DNA.petal(0).lineColor); rings[0].graphics.beginFill(DNA.petalColor(0)); rings[0].graphics.drawCircle(0, 0, (DNA.petal(0).ext * DNA.coreScale())); rings[0].graphics.endFill(); } private function fillRing(_arg1:Shape, _arg2:int){ var _local3:Object; var _local4:*; var _local5:Number; var _local6:Point; var _local7:Point; var _local8:Point; var _local9:Point; var _local10:Point; var _local11:int; _local3 = new Object(); _local4 = DNA.numPetals(_arg2); _local5 = ((Math.random() * Math.PI) * 2); _local11 = 0; while (_local11 < _local4) { _local5 = (_local5 + ((Math.PI * 2) / _local4)); _local3 = DNA.petal(_arg2); _local6 = Point.polar(_local3.r, _local5); _local7 = _local6.add(Point.polar((_local3.ext * _local3.roundness), _local5)); _local8 = Point.polar((_local3.r + _local3.ext), (_local5 + (Math.PI / _local4))); _local10 = Point.polar(_local3.r, (_local5 + ((Math.PI * 2) / _local4))); _local9 = _local10.add(Point.polar((_local3.ext * _local3.roundness), (_local5 + ((Math.PI * 2) / _local4)))); _arg1.graphics.lineStyle(_local3.lineSize, _local3.lineColor, 1, false, LineScaleMode.NONE); _arg1.graphics.beginFill(_local3.color); _arg1.graphics.moveTo(0, 0); _arg1.graphics.lineTo(_local6.x, _local6.y); _arg1.graphics.curveTo(_local7.x, _local7.y, _local8.x, _local8.y); _arg1.graphics.curveTo(_local9.x, _local9.y, _local10.x, _local10.y); _arg1.graphics.lineTo(0, 0); _arg1.graphics.endFill(); _local11++; }; } public function run(){ rings[0].width = (rings[0].width + GROW_SPEED); rings[0].scaleY = rings[0].scaleX; if (rings[0].scaleY >= 1){ rings[0].scaleY = (rings[0].scaleX = 1); size = rings[0].width; rings.shift(); if (rings.length == 0){ dispatchEvent(new Event("flowerDoneEvent", true)); } else { rings[0].width = (rings[0].height = size); }; }; } private function constructRings(){ while (rings.length < DNA.numRings()) { rings.push(new Shape()); fillRing(rings[(rings.length - 1)], (rings.length - 1)); }; } public function finish(){ var _local1:Shape; for each (_local1 in rings) { _local1.scaleY = (_local1.scaleX = 1); }; dispatchEvent(new Event("flowerDoneEvent", true)); } } }//package
Section 7
//GraphicElements (GraphicElements) package { import flash.text.*; import flash.display.*; import flash.filters.*; public class GraphicElements { public static function getMouseOverFilters():Array{ return (new Array(new DropShadowFilter(3, 45, 0, 0.5, 0, 0, 4, 2))); } public static function getMainTextFormat(_arg1:int=12, _arg2:int=2236945):TextFormat{ var _local3:*; _local3 = new TextFormat(); _local3.font = "Gill Sans"; _local3.size = _arg1; _local3.color = _arg2; return (_local3); } public static function makeButton(_arg1:Sprite, _arg2:int, _arg3:String){ var _local4:*; _local4 = new TextField(); _local4.selectable = false; _local4.x = 3; _local4.y = 1; _local4.height = 20; _local4.width = _arg2; _local4.defaultTextFormat = GraphicElements.getMainTextFormat(12, 0xDDDDDD); drawBox(_arg1, _arg2, 20); _local4.text = _arg3; _arg1.addChild(_local4); } public static function drawCheckBox(_arg1:Sprite, _arg2:int, _arg3:int, _arg4:Boolean){ drawBox(_arg1, _arg2, _arg2, _arg3); if (_arg4){ _arg1.graphics.lineStyle(4, 8890250, 1); _arg1.graphics.moveTo((_arg3 + 2), (_arg2 / 2)); _arg1.graphics.curveTo((_arg3 + (_arg2 * 0.4)), (_arg2 * 0.6), (_arg3 + (_arg2 * 0.4)), (_arg2 * 0.9)); _arg1.graphics.curveTo((_arg3 + (_arg2 / 2)), (_arg2 * 0.25), (_arg3 + _arg2), 0); }; } public static function drawBox(_arg1:Sprite, _arg2:int, _arg3:int, _arg4:int=0){ _arg1.graphics.beginFill(3751258); _arg1.graphics.lineStyle(1.5, 6907274, 1); _arg1.graphics.drawRoundRect(_arg4, 0, _arg2, _arg3, 10); _arg1.graphics.endFill(); } } }//package
Section 8
//InstructionScreen (InstructionScreen) package { import flash.display.*; public dynamic class InstructionScreen extends BitmapData { public function InstructionScreen(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 9
//Main (Main) package { import flash.text.*; import flash.display.*; import flash.events.*; public class Main extends Sprite { public var mainText:TextField; public var world:World; private var instructionScreen:Sprite; public static const MOVIE_HEIGHT = 450; public static const MOVIE_WIDTH = 800; public function Main(){ var _local1:*; super(); this.stage.stageWidth = MOVIE_WIDTH; this.stage.stageHeight = MOVIE_HEIGHT; this.stage.scaleMode = StageScaleMode.NO_SCALE; removeChild(mainText); addChild((world = new World(MOVIE_WIDTH, MOVIE_HEIGHT))); world.pause(); addChild((instructionScreen = new Sprite())); _local1 = new Bitmap(new InstructionScreen(800, 450)); instructionScreen.addChild(_local1); instructionScreen.addEventListener(MouseEvent.CLICK, click_handler); } private function enterFrame_handler(_arg1:Event){ instructionScreen.alpha = (instructionScreen.alpha - 0.015); if (instructionScreen.alpha < 0.05){ removeEventListener(Event.ENTER_FRAME, enterFrame_handler); removeChild(instructionScreen); instructionScreen = null; }; } private function click_handler(_arg1:MouseEvent){ instructionScreen.removeEventListener(MouseEvent.CLICK, click_handler); instructionScreen.mouseChildren = false; addEventListener(Event.ENTER_FRAME, enterFrame_handler); world.unpause(); } } }//package
Section 10
//MouseLine (MouseLine) package { import flash.display.*; import flash.events.*; public class MouseLine extends Sprite { public var double_mode:Boolean;// = true private var age:int; private static const SECTION_LENGTH:int = 15; private static const ARROW_WIDTH:Number = 0.4; private static const PHASE_LENGTH:int = 15; private static const ARROW_LENGTH:Number = 0.6; public function MouseLine(){ double_mode = true; super(); age = 0; mouseEnabled = false; this.addEventListener(Event.ADDED_TO_STAGE, added_handler); } private function added_handler(_arg1:Event){ this.addEventListener(Event.ENTER_FRAME, enterFrame_handler, false, 0, true); this.removeEventListener(Event.ADDED_TO_STAGE, added_handler); } private function drawArrow(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){ var _local7:*; var _local8:*; var _local9:Number; var _local10:*; var _local11:*; graphics.lineStyle(4, 0xFFFFFF, 1, false, "normal", CapsStyle.ROUND); graphics.drawCircle(_arg1, _arg2, 5); graphics.moveTo(_arg1, _arg2); _local7 = (_arg3 - _arg1); _local8 = (_arg4 - _arg2); graphics.lineTo((_arg1 + (_arg6 * _local7)), (_arg2 + (_arg6 * _local8))); _local9 = ((2 * _arg5) * _arg6); while (_local9 < 1) { graphics.lineTo((_arg1 + (_local9 * _local7)), (_arg2 + (_local9 * _local8))); graphics.moveTo((_arg1 + ((_local9 + _arg6) * _local7)), (_arg2 + ((_local9 + _arg6) * _local8))); _local9 = (_local9 + (_arg6 * 2)); }; graphics.moveTo((_arg1 + ((1 - _arg6) * _local7)), (_arg2 + ((1 - _arg6) * _local8))); graphics.lineTo(_arg3, _arg4); _local10 = _arg3; _local11 = _arg4; _local10 = (_local10 - ((_arg6 * ARROW_WIDTH) * _local8)); _local11 = (_local11 + ((_arg6 * ARROW_WIDTH) * _local7)); _local10 = (_local10 - ((_arg6 * ARROW_LENGTH) * _local7)); _local11 = (_local11 - ((_arg6 * ARROW_LENGTH) * _local8)); graphics.lineTo(_local10, _local11); _local10 = (_local10 + (((2 * _arg6) * ARROW_WIDTH) * _local8)); _local11 = (_local11 - (((2 * _arg6) * ARROW_WIDTH) * _local7)); graphics.lineTo(_local10, _local11); graphics.lineTo(_arg3, _arg4); } private function enterFrame_handler(_arg1:Event){ var _local2:*; var _local3:*; age++; graphics.clear(); _local2 = Math.sqrt(((mouseX * mouseX) + (mouseY * mouseY))); _local3 = (SECTION_LENGTH / _local2); if (!double_mode){ drawArrow(0, 0, mouseX, mouseY, ((age / PHASE_LENGTH) % 1), _local3); } else { _local3 = (_local3 * 2); drawArrow(0, 0, (mouseX / 2.2), (mouseY / 2.2), ((age / PHASE_LENGTH) % 1), _local3); drawArrow(mouseX, mouseY, (mouseX / 1.8), (mouseY / 1.8), ((age / PHASE_LENGTH) % 1), _local3); graphics.lineStyle(4, 0xFF00); graphics.drawCircle((mouseX / 2), (mouseY / 2), 8); }; } } }//package
Section 11
//Plant (Plant) package { import flash.display.*; import flash.events.*; public class Plant extends Sprite { public var done:Boolean; private var activeFlowers:Array; private var stem:Stem; public var DNA:Blueprint; public var age:int; public function Plant(_arg1:Blueprint=null){ DNA = ((_arg1)!=null) ? _arg1 : new Blueprint(); addChild((stem = new Stem(DNA))); activeFlowers = new Array(); age = 0; done = false; stem.addEventListener("twigReachedEvent", twigReached_handler, false, 0, true); } private function stop(){ dispatchEvent(new Event("plantDoneEvent", true)); } private function twigReached_handler(_arg1:Event){ addFlower(Stick(_arg1.target)); } private function addFlower(_arg1:Stick){ var _local2:Flower; _local2 = new Flower(DNA); _arg1.addChild(_local2); _local2.x = _arg1.tip.x; _local2.y = _arg1.tip.y; activeFlowers.push(_local2); _local2.addEventListener("flowerDoneEvent", flowerDone_handler, false, 0, true); } private function flowerDone_handler(_arg1:Event){ _arg1.target.removeEventListener("flowerDoneEvent", flowerDone_handler); activeFlowers.splice(activeFlowers.indexOf(_arg1.target), 1); } public function run(){ var _local1:Flower; age++; if (!stem.done){ stem.run(); }; for each (_local1 in activeFlowers) { _local1.run(); }; if (((stem.done) && ((activeFlowers.length == 0)))){ stop(); done = true; }; } } }//package
Section 12
//Props (Props) package { dynamic class Props extends Array { function Props(){ this[0] = ["trunkLen", 0, 100, "num"]; this[1] = ["branchColor", 0, 0xFFFFFF, "col"]; this[2] = ["numFlowers", 1, 10, "int"]; this[3] = ["maxLevel", 2, 30, "int"]; this[4] = ["avgBranchLength", 20, 60, "num"]; this[5] = ["apical", 0, 1, "num"]; this[6] = ["tipRadius", 1, 4, "num"]; this[7] = ["radiusMtp", 1, 1.5, "num"]; this[8] = ["maxRootRotation", 0, 80, "num"]; this[9] = ["maxTopRotation", 0, 90, "num"]; this[10] = ["coreScale", 0, 1.6, "num"]; this[11] = ["numRings", 1, 4, "int"]; this[12] = ["petalLengthDev", 0, 0.6, "num"]; this[13] = ["petalHueDev", 0, 0.5, "num"]; this[14] = ["petalSatDev", 0, 0.5, "num"]; this[15] = ["petalValDev", 0, 0.5, "num"]; this[16] = ["petalLineSize", 1, 4, "num"]; this[17] = ["petalLineHue", -0.2, 0.2, "num"]; this[18] = ["petalLineSat", -0.8, 0.8, "num"]; this[19] = ["petalLineVal", -1, 1, "num"]; this[20] = ["coreColor", 0, 0xFFFFFF, "col"]; this[21] = ["rimColor", 0, 0xFFFFFF, "col"]; this[22] = ["coreLength", 5, 15, "num"]; this[23] = ["rimLength", 1, 25, "num"]; this[24] = ["corePetals", 3, 14, "int"]; this[25] = ["rimPetals", 3, 40, "int"]; this[26] = ["coreRoundness", 0, 2, "num"]; this[27] = ["rimRoundness", 0, 2, "num"]; } } }//package
Section 13
//Ranged (Ranged) package { public interface Ranged { function valueOf(); function set val(_arg1); function randomize():void; function mutate(_arg1:Number):void; function combine(_arg1:Ranged):Ranged; } }//package
Section 14
//RangedColor (RangedColor) package { public class RangedColor implements Ranged { public var _val:uint; public function RangedColor(_arg1:uint){ _val = Math.round(_arg1); _val = Math.min(Math.max(0, _val), 0xFFFFFF); } public function valueOf(){ return (_val); } public function set val(_arg1){ _val = _arg1; } public function mutate(_arg1:Number):void{ _val = Colors.randomize(_val, _arg1, _arg1, _arg1); } public function randomize():void{ _val = Colors.randomize(1188660, 1, 1, 1); } public function combine(_arg1:Ranged):Ranged{ var _local2:Ranged; _local2 = new RangedColor(1); _local2.val = Colors.interpolate(this._val, RangedColor(_arg1).valueOf(), 0.5); return (_local2); } } }//package
Section 15
//RangedInt (RangedInt) package { public class RangedInt implements Ranged { private var _val:int; private var _max:int; private var _min:int; public function RangedInt(_arg1:int, _arg2:int, _arg3:int){ _min = _arg1; _max = _arg2; _val = Math.round(_arg3); _val = Math.min(Math.max(_min, _val), _val); } public function valueOf(){ return (_val); } public function set val(_arg1){ _val = _arg1; } public function mutate(_arg1:Number):void{ if (Math.random() < (_arg1 * 2)){ if (Math.random() < 0.5){ _val--; } else { _val++; }; }; _val = Math.max(Math.min(_max, _val), _min); } public function randomize():void{ _val = Math.round((_min + (Math.random() * (_max - _min)))); } public function combine(_arg1:Ranged):Ranged{ var _local2:RangedInt; _local2 = new RangedInt(_min, _max, 0); _local2._max = this._max; _local2._min = this._min; _local2.val = Math.round(((_arg1.valueOf() + this._val) / 2)); return (_local2); } } }//package
Section 16
//RangedNumber (RangedNumber) package { public class RangedNumber implements Ranged { private var _val:Number; private var _max:Number; private var _min:Number; public function RangedNumber(_arg1:Number, _arg2:Number, _arg3:Number){ _min = _arg1; _max = _arg2; _val = _arg3; _val = Math.max(Math.min(_max, _arg3), _min); } public function valueOf(){ return (_val); } public function set val(_arg1){ _val = _arg1; _val = Math.max(Math.min(_max, _val), _min); } public function mutate(_arg1:Number):void{ var _local2:*; _local2 = ((_max - _min) * _arg1); _val = ((_val - _local2) + ((Math.random() * 2) * _local2)); _val = Math.max(Math.min(_max, _val), _min); } public function randomize():void{ _val = (_min + (Math.random() * (_max - _min))); } public function combine(_arg1:Ranged):Ranged{ var _local2:Ranged; _local2 = new RangedNumber(_min, _max, 0); _local2.val = ((_arg1.valueOf() + this._val) / 2); return (_local2); } } }//package
Section 17
//SeedSpray (SeedSpray) package { import flash.display.*; import flash.geom.*; import flash.events.*; public class SeedSpray extends Sprite { private var size:Number; private var allSeeds:Array; private var maxAge:int; private var positions:Array; private var col1; private var col2; private var age:int; private static const EXPLOSION_FORCE:int = 20; private static const FRICTION:Number = 0.95; private static const GRAVITY:Number = 0.4; public function SeedSpray(_arg1:uint=0, _arg2:uint=0, _arg3:int=80, _arg4=12){ this.mouseEnabled = false; maxAge = _arg3; age = 0; size = _arg4; col1 = _arg1; col2 = _arg2; this.addEventListener(Event.ADDED_TO_STAGE, added_handler); } private function added_handler(_arg1:Event){ var _local2:int; var _local3:Shape; var _local4:Point; var _local5:Number; var _local6:Number; this.removeEventListener(Event.ADDED_TO_STAGE, added_handler); allSeeds = new Array(); positions = new Array(); _local2 = 0; while (_local2 < size) { _local3 = new Shape(); _local3.graphics.beginFill(col2); _local3.graphics.lineStyle(2, col1); _local3.graphics.drawCircle(0, 0, 4); addChild(_local3); allSeeds.push(_local3); _local5 = ((0.5 * EXPLOSION_FORCE) + ((Math.random() * 0.5) * EXPLOSION_FORCE)); _local6 = ((Math.random() * Math.PI) + Math.PI); _local4 = Point.polar(_local5, _local6); _local3.x = _local4.x; _local3.y = (_local4.y * 0.8); positions.push(new Point(0, 0)); _local2++; }; this.addEventListener(Event.ENTER_FRAME, enterFrame_handler); } private function enterFrame_handler(_arg1:Event){ var _local2:int; var _local3:*; var _local4:*; var _local5:*; this.alpha = (this.alpha - (1 / maxAge)); age++; _local2 = 0; while (_local2 < size) { _local3 = allSeeds[_local2]; _local4 = positions[_local2]; _local5 = new Point(_local3.x, _local3.y); _local3.x = (_local3.x + ((_local3.x - _local4.x) * FRICTION)); _local3.y = (_local3.y + (((_local3.y - _local4.y) * FRICTION) + GRAVITY)); positions[_local2] = _local5; _local2++; }; if (age > maxAge){ this.removeEventListener(Event.ENTER_FRAME, enterFrame_handler); parent.removeChild(this); }; } } }//package
Section 18
//Shop (Shop) package { import flash.text.*; import flash.display.*; import flash.events.*; public class Shop extends Sprite { private var buttonTargetY:int; private var buttonY:int; private var buttonTargetX:int; private var shopWindow:Sprite; private var showButton:Sprite; private var world:World; private var usedPlants:Array; private var hidden:Boolean; private var windowTargetX:int; private static const SHOP_HEIGHT:int = 300; private static const MOVE_SPEED:Number = 0.3; public static const SHOP_WIDTH:int = 134; public function Shop(_arg1:World, _arg2){ world = _arg1; buttonY = _arg2; usedPlants = new Array(); this.addEventListener(Event.ADDED_TO_STAGE, added_handler); } private function added_handler(_arg1:Event){ this.drawShowButton(); this.drawShop(); this.hideShop(); } private function mouseOver_handler(_arg1:MouseEvent){ _arg1.currentTarget.filters = GraphicElements.getMouseOverFilters(); _arg1.currentTarget.addEventListener(MouseEvent.MOUSE_OUT, mouseOut_handler); } private function showButtonClick_handler(_arg1:MouseEvent){ if (hidden){ showShop(); } else { hideShop(); }; } private function hideShop(){ hidden = true; windowTargetX = SHOP_WIDTH; buttonTargetX = ((SHOP_WIDTH - showButton.width) - 2); buttonTargetY = buttonY; addEventListener(Event.ENTER_FRAME, enterFrame_handler); TextField(showButton.getChildAt(0)).text = "go to shop"; } private function drawShop(){ shopWindow = new Sprite(); GraphicElements.drawBox(shopWindow, SHOP_WIDTH, SHOP_HEIGHT); shopWindow.x = SHOP_WIDTH; addChild(shopWindow); drawShopButtons(); } private function mouseOut_handler(_arg1:MouseEvent){ _arg1.currentTarget.filters = null; } private function enterFrame_handler(_arg1:Event){ shopWindow.x = ((windowTargetX * MOVE_SPEED) + (shopWindow.x * (1 - MOVE_SPEED))); showButton.x = ((buttonTargetX * MOVE_SPEED) + (showButton.x * (1 - MOVE_SPEED))); showButton.y = ((buttonTargetY * MOVE_SPEED) + (showButton.y * (1 - MOVE_SPEED))); if (((((shopWindow.x - windowTargetX) > -1)) && (((shopWindow.x - windowTargetX) < 1)))){ shopWindow.x = windowTargetX; showButton.x = buttonTargetX; showButton.y = buttonTargetY; removeEventListener(Event.ENTER_FRAME, enterFrame_handler); if (hidden){ removeShop(); }; }; } private function removeShop(){ removeChild(shopWindow); shopWindow = null; } private function shopButtonClick_handler(_arg1:MouseEvent){ world.addAnywhere(Species.getSpecies(TextField(_arg1.currentTarget.getChildAt(0)).text)); usedPlants[Species.ALL_SPECIES.indexOf(TextField(_arg1.currentTarget.getChildAt(0)).text)] = 1; hideShop(); } private function drawShopButtons(){ var _local1:*; var _local2:String; var _local3:*; _local1 = 0; for each (_local2 in Species.ALL_SPECIES) { _local3 = new Sprite(); GraphicElements.makeButton(_local3, 100, _local2); GraphicElements.drawCheckBox(_local3, 20, (_local3.width + 2), usedPlants[_local1]); _local3.x = 4; _local3.y = (4 + (_local1 * 24)); shopWindow.addChild(_local3); _local1++; _local3.addEventListener(MouseEvent.MOUSE_OVER, mouseOver_handler, false, 0, true); _local3.addEventListener(MouseEvent.CLICK, shopButtonClick_handler, false, 0, true); }; } private function showShop(){ hidden = false; if (shopWindow == null){ drawShop(); }; TextField(showButton.getChildAt(0)).text = "hide shop"; windowTargetX = -2; buttonTargetX = -2; buttonTargetY = (SHOP_HEIGHT + 4); addEventListener(Event.ENTER_FRAME, enterFrame_handler); } private function drawShowButton(){ showButton = new Sprite(); GraphicElements.makeButton(showButton, 102, "go to Shop"); showButton.y = buttonY; showButton.x = ((SHOP_WIDTH - showButton.width) - 2); addChild(showButton); showButton.addEventListener(MouseEvent.MOUSE_OVER, mouseOver_handler); showButton.addEventListener(MouseEvent.CLICK, showButtonClick_handler); } } }//package
Section 19
//Species (Species) package { public class Species { public static const firelily:String = "92.5, 0x118811, 3, 10, 20.0, 0.0, 1.1, 1.4, 40.0, 80.0, 0.1, 2, 0.1, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, -0.4, 0xdd5544, 0xddaa55, 2.0, 10.0, 6, 6, 1, 0.3"; public static const sponkoo:String = "11.0, 0xc5333, 6, 6, 43.1, 0.8, 1.5, 1.3, 33.5, 82.4, 0.8, 4, 0.2, 0.1, 0.0, 0.0, 2.8, 0.1, 0.8, 0.5, 0x79b027, 0x52191e, 8.3, 18.4, 6, 4, 1.8, 1.9"; public static const cubeflower:String = "20,0xb7aaa7,3, 4,40, 0,1, 1,90,90, 0.2,1, 0, 1, 0,0.2,2, 0,1 , 1,0x000000,0xffffff, 8, 1, 4, 3, 0, 0"; public static const dahlia:String = " 11,0x414001,7, 3,40,0.5,1,1.3,40,90, 0 ,4, 0,0.01, 0, 0,1,-0.1,0.65,-0.2,15250649,16717966,3.5,4.5, 6, 5,0.51,0.9"; public static const boxing_dahlia:String = "15.5, 0x7c7554, 5, 4, 40.0, 0.3, 1.0, 1.1, 60.0, 90.0, 0.1, 3, 0.0, 0.3, 0.0, 0.1, 1.5, -0.1, 0.7, 0.4, 0x745a6c, 0xff8bc6, 6.5, 2.8, 5, 4, 0.3, 0.5"; public static const errorflower:String = "300,0x0000FF,1, 1, 1, 1,1, 1, 0, 0, 1 ,0, 0, 0, 0, 0,0, 0, 0, 0,0x0000FF,0x0000FF, 3,3.2, 4, 4, 0, 0"; public static const cubey:String = "83.4, 0xf17270, 2, 4, 36.6, 1.0, 1.0, 1.0, 0.0, 0.0, 0.2, 1, 0.0, 0.2, 0.0, 0.0, 2.3, -0.1, 0.4, -0.5, 0x2222ff, 0xffffff, 5.0, 13.3, 4, 5, 0.0, 0.3"; public static const alpinelily:String = " 85,0x44bb44,1,10,30,0.0,1.1,1.4, 40.0, 80.0 , 1, 2, 0.1, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, -0.4, 0xddbb44, 0xdd88dd, 5.0, 10.0, 6, 6, 0.5, 0.3"; public static const sakura:String = " 50,0x444458,4,10,30, 0,1,1.4,40,80, 0 ,2, 0.1, 0, 0, 0,1, 0, 0,-0.2,0xFF88DD,0xFFFEFE, 4, 6, 5, 5, 0.5,0.9"; public static const BFOD:String = "errorflower"; public static const mastermee:String = "29.5, 0x415e11, 6, 5, 40.6, 0.4, 1.0, 1.3, 40.0, 87.5, 0.0, 4, 0.0, 0.1, 0.0, 0.1, 1.0, -0.1, 0.5, -0.3, 0xe5b5b3, 0x86b163, 5.0, 5.9, 6, 6, 0.5, 0.8"; public static const ALL_SPECIES:Array = ["alpinelily", "sakura", "sunflower", "dahlia", "cubeflower", "boxing_dahlia", "sponkoo", "mastermee", "cubey"]; public static const sunflower:String = "100,0x55ac65,1, 1,10, 1,3,1.1, 0,50, 2 ,2,0.05, 0,0.1,0.1,1, 0, 0.2,-0.1,0x554433,0xEEEE66, 5, 16,15,30, 1, 1"; public static const STARTER:String = "alpinelily"; public function Species(_arg1:String){ } public static function getSpecies(_arg1:String):Blueprint{ return (Blueprint.fromString(Species[_arg1])); } } }//package
Section 20
//Stem (Stem) package { import flash.display.*; import flash.events.*; public class Stem extends Sprite { private var twigsBuilt:int; private var _done:Boolean; private var trunk:Trunk; private var DNA:Blueprint; public function Stem(_arg1:Blueprint){ var _local2:Stick; super(); DNA = ((_arg1)!=null) ? _arg1 : new Blueprint(); constructTree(); _done = false; twigsBuilt = 0; for each (_local2 in trunk.twigs) { _local2.addEventListener("twigDoneEvent", twigDone_handler, false, 0, true); }; } private function stop(){ _done = true; } private function twigDone_handler(_arg1:Event){ _arg1.target.dispatchEvent(new Event("twigReachedEvent", true)); _arg1.target.removeEventListener("twigDoneEvent", twigDone_handler); twigsBuilt++; if (twigsBuilt >= DNA.numFlowers()){ stop(); }; } private function constructTree(){ var _local1:*; addChild((trunk = new Trunk(DNA.trunkLen(), DNA))); while (trunk.twigs.length < DNA.numFlowers()) { _local1 = trunk.randomBranch; _local1.addBranch(); }; } public function get done():Boolean{ return (_done); } public function run(){ trunk.run(); } public function get twigs():Array{ return (trunk.twigs); } } }//package
Section 21
//Stick (Stick) package { import flash.display.*; import flash.geom.*; import flash.events.*; public class Stick extends Sprite { protected var len:Number; public var mid:Point; protected var prog:Number; protected var b_rad:Number; protected var t_rad:Number; public var branches:Array; protected var DNA:Blueprint; public static const MAX_BRANCHES = 2; public static const GROW_SPEED = 0.025; public function Stick(_arg1){ this.len = _arg1; branches = new Array(0); prog = 0; b_rad = 0; this.addEventListener(Event.ADDED, added_handler, false, 0, true); } public function added_handler(_arg1:Event){ removeEventListener(Event.ADDED, added_handler); this.DNA = Stick(parent).DNA; t_rad = DNA.tipRadius(); } protected function grow():Number{ var _local1:Stick; if (prog < 1){ prog = (prog + GROW_SPEED); drawTo(prog); } else { prog = 1; if (branches.length == 0){ dispatchEvent(new Event("twigDoneEvent", true)); } else { for each (_local1 in branches) { t_rad = Math.max(_local1.grow(), t_rad); }; }; drawTo(1); }; b_rad = (t_rad * (((DNA.radiusMtp() - 1) * prog) + 1)); return (b_rad); } public function get randomBranch():Stick{ var _local1:*; var _local2:Stick; var _local3:*; _local1 = new Array(); if (this.level >= DNA.maxLevel()){ return (null); }; if (branches.length < MAX_BRANCHES){ _local1.push(this); }; for each (_local2 in branches) { _local3 = _local2.randomBranch; if (_local3 != null){ _local1.push(_local3); }; }; if (_local1.length == 0){ if (branches.length < MAX_BRANCHES){ return (this); }; return (null); }; return (_local1[Math.floor((Math.random() * _local1.length))]); } public function get level():int{ return ((Stick(parent).level + 1)); } public function get tip():Point{ return (new Point(0, -(len))); } public function get twigs():Array{ var _local1:*; var _local2:Stick; if (branches.length == 0){ return (new Array(this)); }; _local1 = new Array(); for each (_local2 in branches) { _local1 = _local1.concat(_local2.twigs); }; return (_local1); } public function addBranch(){ var _local1:*; var _local2:*; _local1 = new Stick(DNA.branchLength((level + 1))); _local2 = ((branches.length == 0)) ? (-(angle) / 2) : -(angle); _local1.rotation = (DNA.branchRotation((level + 1)) + _local2); branches.push(_local1); _local1.y = tip.y; if (branches.length == 1){ this.branches[0].rotation = (this.branches[0].rotation * (1 - DNA.apical())); }; addChild(_local1); } public function get angle():Number{ return ((Stick(parent).angle + this.rotation)); } private function drawTo(_arg1:Number){ var _local2:Point; var _local3:Point; var _local4:*; var _local5:Point; var _local6:Point; var _local7:Point; var _local8:Point; var _local9:Point; var _local10:Point; mid = Point.polar((-(len) / 2), ((Math.PI / 2) - ((this.rotation * Math.PI) / 180))); _local2 = Point.interpolate(tip, mid, _arg1); _local3 = Point.interpolate(mid, new Point(0, 0), _arg1); _local2 = Point.interpolate(_local2, _local3, _arg1); _local4 = ((b_rad + t_rad) / 2); _local5 = Point.polar(b_rad, -(((this.rotation * Math.PI) / 180))); _local6 = _local3.add(new Point(_local4, 0)); _local7 = _local2.add(new Point(t_rad, 0)); _local8 = _local2.add(new Point(-(t_rad), 0)); _local9 = _local3.add(new Point(-(_local4), 0)); _local10 = Point.polar(-(b_rad), -(((this.rotation * Math.PI) / 180))); this.graphics.clear(); this.graphics.moveTo(_local5.x, _local5.y); this.graphics.beginFill(DNA.branchColor()); this.graphics.curveTo(_local6.x, _local6.y, _local7.x, _local7.y); this.graphics.lineTo(_local8.x, _local8.y); this.graphics.curveTo(_local9.x, _local9.y, _local10.x, _local10.y); this.graphics.endFill(); this.graphics.beginFill(DNA.branchColor()); this.graphics.drawCircle(_local2.x, _local2.y, t_rad); } } }//package
Section 22
//Trunk (Trunk) package { import flash.events.*; public class Trunk extends Stick { public function Trunk(_arg1, _arg2){ this.prog = 0; super(_arg1); DNA = ((_arg2)!=null) ? _arg2 : new Blueprint(); this.rotation = (-10 + (Math.random() * 20)); } override public function added_handler(_arg1:Event){ t_rad = DNA.tipRadius(); removeEventListener(Event.ADDED_TO_STAGE, added_handler); } override public function get level():int{ return (0); } public function run(){ this.grow(); } override public function get angle():Number{ return (this.rotation); } } }//package
Section 23
//World (World) package { import flash.display.*; import flash.geom.*; import flash.events.*; import flash.filters.*; public class World extends Sprite { private var activePlants:Array; private var automatic:Boolean; private var background:Bitmap; private var mouseUpSlot:int; private var sky:Shape; private var mouseLine:MouseLine; public var worldWidth:uint; private var allPlants:Sprite; public var worldHeight:uint; private var ground:Sprite; private var plantSlots:Array; private var mouseDownSlot:int; private var autoButton:Sprite; private var bReader:BlueprintReader; private var autoButtonCheck:Sprite; private var shop:Shop; private static const MOUSE_OVER_FILTER:Array = GraphicElements.getMouseOverFilters(); private static const MAX_PLANTS = 5; private static const SLOT_WIDTH_FACTOR:Number = 0.6; private static const USE_BACKGROUND:Boolean = false; private static const GROUNDHEIGHT:Number = 30; public function World(_arg1:int=800, _arg2:int=500){ this.worldWidth = _arg1; this.worldHeight = _arg2; bReader = new BlueprintReader(this); bReader.x = (_arg1 - BlueprintReader.READER_WIDTH); bReader.y = 2; shop = new Shop(this, 98); shop.x = (_arg1 - Shop.SHOP_WIDTH); constructSky(); if (USE_BACKGROUND){ constructBackground(); }; addChild((allPlants = new Sprite())); constructGround(GROUNDHEIGHT); addChild(bReader); constructAutoButton(); addChild(shop); plantSlots = new Array(MAX_PLANTS); activePlants = new Array(); mouseUpSlot = -1; mouseDownSlot = -1; automatic = false; this.addEventListener(Event.ADDED, added_handler, false, 0, true); } public function pause(){ if (hasEventListener(Event.ENTER_FRAME)){ this.removeEventListener(Event.ENTER_FRAME, enterFrame_handler); }; } private function plantMouseOut_handler(_arg1:MouseEvent){ _arg1.currentTarget.filters = null; if (mouseLine != null){ mouseLine.double_mode = false; }; mouseUpSlot = -1; _arg1.currentTarget.removeEventListener(MouseEvent.MOUSE_OUT, plantMouseOut_handler); } private function added_handler(_arg1:Event){ this.removeEventListener(Event.ADDED, added_handler); bReader.addEventListener(MouseEvent.MOUSE_UP, readerMouseUp_handler); start(); addPlant(2, Species.getSpecies(Species.STARTER)); } private function buttonMouseOver_handler(_arg1:MouseEvent){ _arg1.currentTarget.addEventListener(MouseEvent.MOUSE_OUT, buttonMouseOut_handler); _arg1.currentTarget.filters = GraphicElements.getMouseOverFilters(); } private function removeMouseLine(){ if (mouseLine != null){ removeChild(mouseLine); mouseLine = null; }; } public function mouseUp_handler(_arg1:MouseEvent){ if (bReader.hitTestPoint(mouseX, mouseY, true)){ if (plantSlots[mouseDownSlot] != null){ bReader.setBlueprint(plantSlots[mouseDownSlot].DNA); bReader.showWindow(); }; } else { if (this.hasEventListener(MouseEvent.MOUSE_MOVE)){ if (!_arg1.shiftKey){ procreate(mouseDownSlot); } else { remove(mouseDownSlot); }; this.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMove_handler); } else { if ((((mouseUpSlot == -1)) || ((mouseUpSlot == mouseDownSlot)))){ cloneTo(mouseDownSlot, getClosestSlot(mouseX)); } else { combine(mouseDownSlot, mouseUpSlot); }; }; }; this.removeEventListener(MouseEvent.MOUSE_UP, mouseUp_handler); removeMouseLine(); } public function randomMove(){ if (getRandomSlot() >= 0){ if (Math.random() < 0.5){ procreate(getRandomSlot()); } else { combine(getRandomSlot(), getRandomSlot()); }; }; } public function unpause(){ if (!hasEventListener(Event.ENTER_FRAME)){ this.addEventListener(Event.ENTER_FRAME, enterFrame_handler); }; } private function clearPlants(){ var _local1:*; var _local2:*; var _local3:*; _local1 = 0; while (_local1 < allPlants.numChildren) { _local2 = allPlants.getChildAt(_local1); if (plantSlots.indexOf(_local2) == -1){ if (USE_BACKGROUND){ addToBackground(_local2); }; allPlants.removeChild(_local2); _local3 = activePlants.indexOf(_local2); if (_local3 > -1){ activePlants.splice(_local3, 1); }; }; _local1++; }; } private function emptyPlantSlot():int{ var _local1:int; _local1 = 0; while (_local1 < MAX_PLANTS) { if (plantSlots[_local1] == null){ return (_local1); }; _local1++; }; return (-1); } public function combine(_arg1, _arg2){ var _local3:*; var _local4:int; _local3 = plantSlots[_arg1].DNA.combine(plantSlots[_arg2].DNA); if (emptyPlantSlot() > -1){ _local4 = emptyPlantSlot(); } else { _local4 = Math.floor((Math.random() * (MAX_PLANTS - 2))); if (_local4 >= _arg1){ _local4++; }; if (_local4 >= _arg2){ _local4++; }; }; spawnSeedSpray(plantSlots[_arg1].x, (worldHeight - 150), _local3.petal().color, _local3.branchColor()); spawnSeedSpray(plantSlots[_arg2].x, (worldHeight - 150), _local3.petal().color, _local3.branchColor()); addPlant(_local4, _local3); } private function constructGround(_arg1){ var _local2:int; var _local3:*; var _local4:Number; ground = new Sprite(); ground.graphics.beginFill(8087373); ground.graphics.moveTo(0, worldHeight); ground.graphics.lineTo(0, (worldHeight - _arg1)); ground.graphics.curveTo((worldWidth / 2), (worldHeight - ((_arg1 * 4) / 3)), worldWidth, (worldHeight - _arg1)); ground.graphics.lineTo(worldWidth, worldHeight); ground.graphics.endFill(); addChild(ground); _local2 = 0; while (_local2 < MAX_PLANTS) { _local3 = new FertileEarth(); addChild(_local3); _local4 = (worldWidth / (MAX_PLANTS + 1)); _local3.x = (((_local2 + 1) * _local4) - ((0.5 * _local4) * SLOT_WIDTH_FACTOR)); _local3.y = (worldHeight - _arg1); _local3.scaleX = (_local3.scaleY = (SLOT_WIDTH_FACTOR * (_local4 / _local3.width))); _local2++; }; } private function autoButtonClick_handler(_arg1:MouseEvent){ autoButtonCheck.graphics.clear(); if (automatic == true){ automatic = false; GraphicElements.drawCheckBox(autoButtonCheck, 20, 0, false); } else { GraphicElements.drawCheckBox(autoButtonCheck, 20, 0, true); automatic = true; }; } private function deactivatePlant(_arg1){ activePlants.splice(activePlants.indexOf(_arg1), 1); } public function start(){ this.addEventListener(Event.ENTER_FRAME, enterFrame_handler, false, 0, true); } private function getRandomSlot():int{ var _local1:Array; var _local2:int; var _local3:int; _local1 = new Array(); _local3 = 0; while (_local3 < MAX_PLANTS) { if (plantSlots[_local3] != null){ _local1.push(_local3); }; _local3++; }; if (_local1.length > 0){ _local2 = Math.floor((Math.random() * _local1.length)); return (_local1[_local2]); }; return (-1); } private function mouseMove_handler(_arg1:MouseEvent){ removeMouseLine(); mouseLine = new MouseLine(); mouseLine.double_mode = false; mouseLine.x = mouseX; mouseLine.y = mouseY; addChild(mouseLine); this.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMove_handler); } private function constructBackground(){ background = new Bitmap(new BitmapData(worldWidth, worldHeight, true, 0)); addChild(background); } public function addAnywhere(_arg1:Blueprint){ var _local2:int; if (emptyPlantSlot() > -1){ _local2 = emptyPlantSlot(); } else { _local2 = Math.floor((Math.random() * MAX_PLANTS)); }; addPlant(_local2, _arg1); spawnSeedSpray((worldWidth / 2), (worldHeight / 3), _arg1.petal().color, _arg1.branchColor()); } private function addToBackground(_arg1:Plant){ var _local2:ColorTransform; _arg1.filters = null; _arg1.alpha = 0.7; background.bitmapData.lock(); background.bitmapData.draw(_arg1, _arg1.transform.matrix, _arg1.transform.colorTransform, BlendMode.OVERLAY); _local2 = new ColorTransform(); _local2.alphaMultiplier = 0.9; _local2.color = 4666408; background.bitmapData.colorTransform(background.bitmapData.rect, _local2); background.bitmapData.applyFilter(background.bitmapData, new Rectangle(0, 0, worldWidth, worldHeight), new Point(0, 0), new BlurFilter(1.2, 1.2, 2)); background.bitmapData.unlock(); _arg1.alpha = 1; } public function addPlant(_arg1:int, _arg2:Blueprint){ var _local3:*; var _local4:Number; if ((((_arg1 > (MAX_PLANTS - 1))) || ((_arg1 < 0)))){ throw (new Error("Illegal Plant Slot")); }; _local3 = new Plant(_arg2); allPlants.addChild(_local3); activePlants.push(_local3); plantSlots[_arg1] = _local3; _local4 = (worldWidth / (MAX_PLANTS + 1)); _local3.x = ((_arg1 + 1) * _local4); _local3.x = (_local3.x + (((-0.5 * _local4) + (Math.random() * _local4)) * SLOT_WIDTH_FACTOR)); _local3.y = (worldHeight - GROUNDHEIGHT); _local3.addEventListener("plantDoneEvent", plantDone_handler); _local3.addEventListener(MouseEvent.MOUSE_OVER, plantMouseOver_handler, false, 0, true); _local3.addEventListener(MouseEvent.MOUSE_DOWN, plantMouseDown_handler, false, 0, true); } public function remove(_arg1:int){ plantSlots[_arg1] = null; } public function spawnSeedSpray(_arg1, _arg2, _arg3, _arg4){ var _local5:*; _local5 = new SeedSpray(_arg3, _arg4); _local5.x = _arg1; _local5.y = _arg2; addChildAt(_local5, 2); } private function enterFrame_handler(_arg1:Event){ run(); } public function run(){ var _local1:Plant; for each (_local1 in activePlants) { _local1.run(); }; if ((((automatic == true)) && ((activePlants.length == 0)))){ randomMove(); }; clearPlants(); } private function plantDone_handler(_arg1:Event){ _arg1.target.removeEventListener("plantDoneEvent", plantDone_handler); deactivatePlant(_arg1.target); } private function getClosestSlot(_arg1):int{ var _local2:*; _local2 = (Math.round(((_arg1 / worldWidth) * (MAX_PLANTS + 1))) - 1); _local2 = Math.max(0, Math.min((MAX_PLANTS - 1), _local2)); return (_local2); } private function constructSky(_arg1:uint=12040191){ var _local2:Matrix; var _local3:Array; var _local4:Array; var _local5:Array; if (sky != null){ if (this.contains(sky)){ removeChild(sky); }; }; _local2 = new Matrix(); _local2.createGradientBox(worldWidth, worldHeight, (-(Math.PI) / 2)); _local3 = [_arg1, 15662079]; _local4 = [1, 1]; _local5 = [0, 0xFF]; sky = new Shape(); sky.graphics.beginGradientFill(GradientType.LINEAR, _local3, _local4, _local5, _local2); sky.graphics.drawRect(0, 0, worldWidth, worldHeight); addChildAt(sky, 0); } private function buttonMouseOut_handler(_arg1:MouseEvent){ _arg1.currentTarget.filters = null; } public function plantMouseDown_handler(_arg1:MouseEvent){ var _local2:int; _local2 = plantSlots.indexOf(_arg1.currentTarget); if (_local2 > -1){ mouseDownSlot = _local2; this.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove_handler, false, 0, true); this.addEventListener(MouseEvent.MOUSE_UP, mouseUp_handler, false, 0, true); }; } public function cloneTo(_arg1:int, _arg2:int){ var _local3:*; _local3 = plantSlots[_arg1].DNA.clone(); spawnSeedSpray(mouseX, mouseY, _local3.petal().color, _local3.branchColor()); addPlant(_arg2, _local3); } private function readerMouseUp_handler(_arg1:MouseEvent){ } public function procreate(_arg1:int){ var _local2:*; var _local3:int; if (plantSlots[_arg1] == null){ throw (new Error("Slot has no plant in it")); }; _local2 = plantSlots[_arg1].DNA.clone(); _local2.mutate(); _local2.mutate(); _local2.mutate(0.2); spawnSeedSpray(plantSlots[_arg1].x, (worldHeight - 100), _local2.petal().color, _local2.branchColor()); if (emptyPlantSlot() > -1){ _local3 = emptyPlantSlot(); } else { _local3 = Math.floor((Math.random() * (MAX_PLANTS - 1))); if (_local3 >= _arg1){ _local3++; }; }; addPlant(_local3, _local2); } private function plantMouseOver_handler(_arg1:MouseEvent){ var _local2:int; _arg1.currentTarget.filters = MOUSE_OVER_FILTER; if (mouseLine != null){ mouseLine.double_mode = true; }; _local2 = plantSlots.indexOf(_arg1.currentTarget); if (_local2 > -1){ mouseUpSlot = _local2; }; _arg1.currentTarget.addEventListener(MouseEvent.MOUSE_OUT, plantMouseOut_handler); } private function constructAutoButton(){ autoButton = new Sprite(); autoButtonCheck = new Sprite(); autoButton.x = (worldWidth - 108); autoButton.y = 74; GraphicElements.makeButton(autoButton, 78, "evolv-o-matic"); autoButtonCheck.x = autoButton.width; GraphicElements.drawCheckBox(autoButtonCheck, 20, 0, false); addChild(autoButton); autoButton.addChild(autoButtonCheck); autoButton.addEventListener(MouseEvent.CLICK, autoButtonClick_handler, false, 0, true); autoButton.addEventListener(MouseEvent.MOUSE_OVER, buttonMouseOver_handler, false, 0, true); } } }//package

Library Items

Symbol 1 Bitmap {InstructionScreen}
Symbol 2 GraphicUsed by:3
Symbol 3 MovieClip {FertileEarth}Uses:2
Symbol 4 FontUsed by:5
Symbol 5 EditableTextUses:4Used by:Timeline

Instance Names

"mainText"Frame 1Symbol 5 EditableText

Special Tags

FileAttributes (69)Timeline Frame 1Access local files only, Metadata not present, AS3.
Protect (24)Timeline Frame 131 bytes "..$1$Y/$/3OpPqL4VxSTdCt1NBsKZ.."




http://swfchan.com/1/2234/info.shtml
Created: 17/6 -2019 16:29:43 Last modified: 17/6 -2019 16:29:43 Server time: 21/12 -2024 18:55:14